]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/etonline.py
release 2017.10.15
[youtube-dl] / youtube_dl / extractor / etonline.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class ETOnlineIE(InfoExtractor):
10     _VALID_URL = r'https?://(?:www\.)?etonline\.com/(?:[^/]+/)*(?P<id>[^/?#&]+)'
11     _TESTS = [{
12         'url': 'http://www.etonline.com/tv/211130_dove_cameron_liv_and_maddie_emotional_episode_series_finale/',
13         'info_dict': {
14             'id': '211130_dove_cameron_liv_and_maddie_emotional_episode_series_finale',
15             'title': 'md5:a21ec7d3872ed98335cbd2a046f34ee6',
16             'description': 'md5:8b94484063f463cca709617c79618ccd',
17         },
18         'playlist_count': 2,
19     }, {
20         'url': 'http://www.etonline.com/media/video/here_are_the_stars_who_love_bringing_their_moms_as_dates_to_the_oscars-211359/',
21         'only_matching': True,
22     }]
23     BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1242911076001/default_default/index.html?videoId=ref:%s'
24
25     def _real_extract(self, url):
26         playlist_id = self._match_id(url)
27
28         webpage = self._download_webpage(url, playlist_id)
29
30         entries = [
31             self.url_result(
32                 self.BRIGHTCOVE_URL_TEMPLATE % video_id, 'BrightcoveNew', video_id)
33             for video_id in re.findall(
34                 r'site\.brightcove\s*\([^,]+,\s*["\'](title_\d+)', webpage)]
35
36         return self.playlist_result(
37             entries, playlist_id,
38             self._og_search_title(webpage, fatal=False),
39             self._og_search_description(webpage))