]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ustream.py
Imported Upstream version 2013.08.17
[youtubedl] / youtube_dl / extractor / ustream.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class UstreamIE(InfoExtractor):
7 _VALID_URL = r'https?://www\.ustream\.tv/recorded/(?P<videoID>\d+)'
8 IE_NAME = u'ustream'
9 _TEST = {
10 u'url': u'http://www.ustream.tv/recorded/20274954',
11 u'file': u'20274954.flv',
12 u'md5': u'088f151799e8f572f84eb62f17d73e5c',
13 u'info_dict': {
14 u"uploader": u"Young Americans for Liberty",
15 u"title": u"Young Americans for Liberty February 7, 2012 2:28 AM"
16 }
17 }
18
19 def _real_extract(self, url):
20 m = re.match(self._VALID_URL, url)
21 video_id = m.group('videoID')
22
23 video_url = u'http://tcdn.ustream.tv/video/%s' % video_id
24 webpage = self._download_webpage(url, video_id)
25
26 self.report_extraction(video_id)
27
28 video_title = self._html_search_regex(r'data-title="(?P<title>.+)"',
29 webpage, u'title')
30
31 uploader = self._html_search_regex(r'data-content-type="channel".*?>(?P<uploader>.*?)</a>',
32 webpage, u'uploader', fatal=False, flags=re.DOTALL)
33
34 thumbnail = self._html_search_regex(r'<link rel="image_src" href="(?P<thumb>.*?)"',
35 webpage, u'thumbnail', fatal=False)
36
37 info = {
38 'id': video_id,
39 'url': video_url,
40 'ext': 'flv',
41 'title': video_title,
42 'uploader': uploader,
43 'thumbnail': thumbnail,
44 }
45 return info