2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class EllenTVIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)'
16 'url': 'http://www.ellentv.com/videos/0-ipq1gsai/',
17 'md5': '8e3c576bf2e9bfff4d76565f56f94c9c',
21 'title': 'Fast Fingers of Fate',
22 'description': 'md5:686114ced0a032926935e9015ee794ac',
23 'timestamp': 1428033600,
24 'upload_date': '20150403',
27 'url': 'http://ellentube.com/videos/0-dvzmabd5/',
28 'md5': '98238118eaa2bbdf6ad7f708e3e4f4eb',
32 'title': '1 year old twin sister makes her brother laugh',
33 'description': '1 year old twin sister makes her brother laugh',
34 'timestamp': 1419542075,
35 'upload_date': '20141225',
39 def _real_extract(self, url):
40 video_id = self._match_id(url)
42 webpage = self._download_webpage(url, video_id)
44 video_url = self._html_search_meta('VideoURL', webpage, 'url', fatal=True)
45 title = self._og_search_title(webpage, default=None) or self._search_regex(
46 r'pageName\s*=\s*"([^"]+)"', webpage, 'title')
47 description = self._html_search_meta(
48 'description', webpage, 'description') or self._og_search_description(webpage)
49 timestamp = parse_iso8601(self._search_regex(
50 r'<span class="publish-date"><time datetime="([^"]+)">',
51 webpage, 'timestamp', fatal=False))
57 'description': description,
58 'timestamp': timestamp,
62 class EllenTVClipsIE(InfoExtractor):
63 IE_NAME = 'EllenTV:clips'
64 _VALID_URL = r'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)'
66 'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/',
68 'id': 'meryl-streep-vanessa-hudgens',
69 'title': 'Meryl Streep, Vanessa Hudgens',
71 'playlist_mincount': 9,
74 def _real_extract(self, url):
75 playlist_id = self._match_id(url)
77 webpage = self._download_webpage(url, playlist_id)
78 playlist = self._extract_playlist(webpage)
83 'title': self._og_search_title(webpage),
84 'entries': self._extract_entries(playlist)
87 def _extract_playlist(self, webpage):
88 json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
90 return json.loads("[{" + json_string + "}]")
91 except ValueError as ve:
92 raise ExtractorError('Failed to download JSON', cause=ve)
94 def _extract_entries(self, playlist):
95 return [self.url_result(item['url'], 'EllenTV') for item in playlist]