4 from .common import InfoExtractor
11 class UstreamIE(InfoExtractor):
12 _VALID_URL = r'https?://www\.ustream\.tv/recorded/(?P<videoID>\d+)'
15 u'url': u'http://www.ustream.tv/recorded/20274954',
16 u'file': u'20274954.flv',
17 u'md5': u'088f151799e8f572f84eb62f17d73e5c',
19 u"uploader": u"Young Americans for Liberty",
20 u"title": u"Young Americans for Liberty February 7, 2012 2:28 AM"
24 def _real_extract(self, url):
25 m = re.match(self._VALID_URL, url)
26 video_id = m.group('videoID')
28 video_url = u'http://tcdn.ustream.tv/video/%s' % video_id
29 webpage = self._download_webpage(url, video_id)
31 self.report_extraction(video_id)
33 video_title = self._html_search_regex(r'data-title="(?P<title>.+)"',
36 uploader = self._html_search_regex(r'data-content-type="channel".*?>(?P<uploader>.*?)</a>',
37 webpage, u'uploader', fatal=False, flags=re.DOTALL)
39 thumbnail = self._html_search_regex(r'<link rel="image_src" href="(?P<thumb>.*?)"',
40 webpage, u'thumbnail', fatal=False)
48 'thumbnail': thumbnail,
52 class UstreamChannelIE(InfoExtractor):
53 _VALID_URL = r'https?://www\.ustream\.tv/channel/(?P<slug>.+)'
54 IE_NAME = u'ustream:channel'
56 def _real_extract(self, url):
57 m = re.match(self._VALID_URL, url)
58 slug = m.group('slug')
59 webpage = self._download_webpage(url, slug)
60 channel_id = get_meta_content('ustream:channel_id', webpage)
62 BASE = 'http://www.ustream.tv'
63 next_url = '/ajax/socialstream/videos/%s/1.json' % channel_id
66 reply = json.loads(self._download_webpage(compat_urlparse.urljoin(BASE, next_url), channel_id))
67 video_ids.extend(re.findall(r'data-content-id="(\d.*)"', reply['data']))
68 next_url = reply['nextUrl']
70 urls = ['http://www.ustream.tv/recorded/' + vid for vid in video_ids]
71 url_entries = [self.url_result(eurl, 'Ustream') for eurl in urls]
72 return self.playlist_result(url_entries, channel_id)