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(
43 'http://widgets.ellentube.com/videos/%s' % video_id,
46 partner_id = self._search_regex(
47 r"var\s+partnerId\s*=\s*'([^']+)", webpage, 'partner id')
49 kaltura_id = self._search_regex(
50 [r'id="kaltura_player_([^"]+)"',
51 r"_wb_entry_id\s*:\s*'([^']+)",
52 r'data-kaltura-entry-id="([^"]+)'],
53 webpage, 'kaltura id')
55 return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), 'Kaltura')
58 class EllenTVClipsIE(InfoExtractor):
59 IE_NAME = 'EllenTV:clips'
60 _VALID_URL = r'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)'
62 'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/',
64 'id': 'meryl-streep-vanessa-hudgens',
65 'title': 'Meryl Streep, Vanessa Hudgens',
67 'playlist_mincount': 9,
70 def _real_extract(self, url):
71 playlist_id = self._match_id(url)
73 webpage = self._download_webpage(url, playlist_id)
74 playlist = self._extract_playlist(webpage)
79 'title': self._og_search_title(webpage),
80 'entries': self._extract_entries(playlist)
83 def _extract_playlist(self, webpage):
84 json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
86 return json.loads("[{" + json_string + "}]")
87 except ValueError as ve:
88 raise ExtractorError('Failed to download JSON', cause=ve)
90 def _extract_entries(self, playlist):
91 return [self.url_result(item['url'], 'EllenTV') for item in playlist]