2 from __future__ import unicode_literals
7 from .common import InfoExtractor
14 class EllenTVIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?(ellentv|ellentube)\.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 'url': 'http://ellentube.com/videos/0-dvzmabd5/',
29 'md5': '98238118eaa2bbdf6ad7f708e3e4f4eb',
33 'title': '1 year old twin sister makes her brother laugh',
34 'timestamp': 1419542075,
35 'upload_date': '20141225',
39 def _real_extract(self, url):
40 mobj = re.match(self._VALID_URL, url)
41 video_id = mobj.group('id')
43 webpage = self._download_webpage(url, video_id)
44 timestamp = parse_iso8601(self._search_regex(
45 r'<span class="publish-date"><time datetime="([^"]+)">',
46 webpage, 'timestamp'))
53 'title': self._og_search_title(webpage),
54 'url': self._html_search_meta('VideoURL', webpage, 'url'),
55 'timestamp': timestamp,
59 class EllenTVClipsIE(InfoExtractor):
60 IE_NAME = 'EllenTV:clips'
61 _VALID_URL = r'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)'
63 'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/',
65 'id': 'meryl-streep-vanessa-hudgens',
66 'title': 'Meryl Streep, Vanessa Hudgens',
68 'playlist_mincount': 9,
71 def _real_extract(self, url):
72 mobj = re.match(self._VALID_URL, url)
73 playlist_id = mobj.group('id')
75 webpage = self._download_webpage(url, playlist_id)
76 playlist = self._extract_playlist(webpage)
81 'title': self._og_search_title(webpage),
82 'entries': self._extract_entries(playlist)
85 def _extract_playlist(self, webpage):
86 json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
88 return json.loads("[{" + json_string + "}]")
89 except ValueError as ve:
90 raise ExtractorError('Failed to download JSON', cause=ve)
92 def _extract_entries(self, playlist):
93 return [self.url_result(item['url'], 'EllenTV') for item in playlist]