]>
Commit | Line | Data |
---|---|---|
9f5daf00 PH |
1 | import re |
2 | ||
3 | from .common import InfoExtractor | |
9f5daf00 PH |
4 | |
5 | ||
6 | class RedTubeIE(InfoExtractor): | |
7 | _VALID_URL = r'(?:http://)?(?:www\.)?redtube\.com/(?P<id>[0-9]+)' | |
6f5ac90c PH |
8 | _TEST = { |
9 | u'url': u'http://www.redtube.com/66418', | |
10 | u'file': u'66418.mp4', | |
d1c25204 PH |
11 | # md5 varies from time to time, as in |
12 | # https://travis-ci.org/rg3/youtube-dl/jobs/14052463#L295 | |
13 | #u'md5': u'7b8c22b5e7098a3e1c09709df1126d2d', | |
6f5ac90c | 14 | u'info_dict': { |
50a6150e RB |
15 | u"title": u"Sucked on a toilet", |
16 | u"age_limit": 18, | |
6f5ac90c PH |
17 | } |
18 | } | |
9f5daf00 | 19 | |
cd214418 | 20 | def _real_extract(self, url): |
9f5daf00 | 21 | mobj = re.match(self._VALID_URL, url) |
9f5daf00 PH |
22 | |
23 | video_id = mobj.group('id') | |
cd214418 | 24 | video_extension = 'mp4' |
9f5daf00 PH |
25 | webpage = self._download_webpage(url, video_id) |
26 | ||
27 | self.report_extraction(video_id) | |
28 | ||
cd214418 PH |
29 | video_url = self._html_search_regex( |
30 | r'<source src="(.+?)" type="video/mp4">', webpage, u'video URL') | |
9f5daf00 | 31 | |
cd214418 PH |
32 | video_title = self._html_search_regex( |
33 | r'<h1 class="videoTitle slidePanelMovable">(.+?)</h1>', | |
9f5daf00 PH |
34 | webpage, u'title') |
35 | ||
1310bf24 PH |
36 | # No self-labeling, but they describe themselves as |
37 | # "Home of Videos Porno" | |
38 | age_limit = 18 | |
39 | ||
cd214418 | 40 | return { |
1310bf24 PH |
41 | 'id': video_id, |
42 | 'url': video_url, | |
43 | 'ext': video_extension, | |
44 | 'title': video_title, | |
45 | 'age_limit': age_limit, | |
cd214418 | 46 | } |