2 from __future__ import unicode_literals
7 from .common import InfoExtractor
14 class EllenTVIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?ellentv\.com/videos/(?P<id>[a-z0-9_-]+)'
17 'url': 'http://www.ellentv.com/videos/0-7jqrsr18/',
18 'md5': 'e4af06f3bf0d5f471921a18db5764642',
22 'title': 'What\'s Wrong with These Photos? A Whole Lot',
23 'timestamp': 1406876400,
24 'upload_date': '20140801',
28 def _real_extract(self, url):
29 mobj = re.match(self._VALID_URL, url)
30 video_id = mobj.group('id')
32 webpage = self._download_webpage(url, video_id)
33 timestamp = parse_iso8601(self._search_regex(
34 r'<span class="publish-date"><time datetime="([^"]+)">',
35 webpage, 'timestamp'))
39 'title': self._og_search_title(webpage),
40 'url': self._html_search_meta('VideoURL', webpage, 'url'),
41 'timestamp': timestamp,
45 class EllenTVClipsIE(InfoExtractor):
46 IE_NAME = 'EllenTV:clips'
47 _VALID_URL = r'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)'
49 'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/',
51 'id': 'meryl-streep-vanessa-hudgens',
52 'title': 'Meryl Streep, Vanessa Hudgens',
54 'playlist_mincount': 9,
57 def _real_extract(self, url):
58 mobj = re.match(self._VALID_URL, url)
59 playlist_id = mobj.group('id')
61 webpage = self._download_webpage(url, playlist_id)
62 playlist = self._extract_playlist(webpage)
67 'title': self._og_search_title(webpage),
68 'entries': self._extract_entries(playlist)
71 def _extract_playlist(self, webpage):
72 json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
74 return json.loads("[{" + json_string + "}]")
75 except ValueError as ve:
76 raise ExtractorError('Failed to download JSON', cause=ve)
78 def _extract_entries(self, playlist):
79 return [self.url_result(item['url'], 'EllenTV') for item in playlist]