]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/redtube.py
Merge tag 'upstream/2013.06.26'
[youtubedl] / youtube_dl / extractor / redtube.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class RedTubeIE(InfoExtractor):
7 _VALID_URL = r'(?:http://)?(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
8
9 def _real_extract(self,url):
10 mobj = re.match(self._VALID_URL, url)
11
12 video_id = mobj.group('id')
13 video_extension = 'mp4'
14 webpage = self._download_webpage(url, video_id)
15
16 self.report_extraction(video_id)
17
18 video_url = self._html_search_regex(r'<source src="(.+?)" type="video/mp4">',
19 webpage, u'video URL')
20
21 video_title = self._html_search_regex('<h1 class="videoTitle slidePanelMovable">(.+?)</h1>',
22 webpage, u'title')
23
24 return [{
25 'id': video_id,
26 'url': video_url,
27 'ext': video_extension,
28 'title': video_title,
29 }]