]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ustream.py
cfe3a6840af834a1f4740c7c4f7290c63b591096
[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
10 def _real_extract(self, url):
11 m = re.match(self._VALID_URL, url)
12 video_id = m.group('videoID')
13
14 video_url = u'http://tcdn.ustream.tv/video/%s' % video_id
15 webpage = self._download_webpage(url, video_id)
16
17 self.report_extraction(video_id)
18
19 video_title = self._html_search_regex(r'data-title="(?P<title>.+)"',
20 webpage, u'title')
21
22 uploader = self._html_search_regex(r'data-content-type="channel".*?>(?P<uploader>.*?)</a>',
23 webpage, u'uploader', fatal=False, flags=re.DOTALL)
24
25 thumbnail = self._html_search_regex(r'<link rel="image_src" href="(?P<thumb>.*?)"',
26 webpage, u'thumbnail', fatal=False)
27
28 info = {
29 'id': video_id,
30 'url': video_url,
31 'ext': 'flv',
32 'title': video_title,
33 'uploader': uploader,
34 'thumbnail': thumbnail,
35 }
36 return info