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:587e79fbbd0d73b148bc596d99ce48e6',
23 'timestamp': 1428035648,
24 'upload_date': '20150403',
25 'uploader_id': 'batchUser',
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
32 webpage = self._download_webpage(
33 'http://widgets.ellentube.com/videos/%s' % video_id,
36 partner_id = self._search_regex(
37 r"var\s+partnerId\s*=\s*'([^']+)", webpage, 'partner id')
39 kaltura_id = self._search_regex(
40 [r'id="kaltura_player_([^"]+)"',
41 r"_wb_entry_id\s*:\s*'([^']+)",
42 r'data-kaltura-entry-id="([^"]+)'],
43 webpage, 'kaltura id')
45 return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), 'Kaltura')
48 class EllenTVClipsIE(InfoExtractor):
49 IE_NAME = 'EllenTV:clips'
50 _VALID_URL = r'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)'
52 'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/',
54 'id': 'meryl-streep-vanessa-hudgens',
55 'title': 'Meryl Streep, Vanessa Hudgens',
57 'playlist_mincount': 9,
60 def _real_extract(self, url):
61 playlist_id = self._match_id(url)
63 webpage = self._download_webpage(url, playlist_id)
64 playlist = self._extract_playlist(webpage)
69 'title': self._og_search_title(webpage),
70 'entries': self._extract_entries(playlist)
73 def _extract_playlist(self, webpage):
74 json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
76 return json.loads("[{" + json_string + "}]")
77 except ValueError as ve:
78 raise ExtractorError('Failed to download JSON', cause=ve)
80 def _extract_entries(self, playlist):
81 return [self.url_result(item['url'], 'EllenTV') for item in playlist]