]> jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/redtube.py
Merge remote-tracking branch 'Rudloff/websurg'
[yt-dlp.git] / 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 _TEST = {
9 u'url': u'http://www.redtube.com/66418',
10 u'file': u'66418.mp4',
11 u'md5': u'7b8c22b5e7098a3e1c09709df1126d2d',
12 u'info_dict': {
13 u"title": u"Sucked on a toilet"
14 }
15 }
16
17 def _real_extract(self, url):
18 mobj = re.match(self._VALID_URL, url)
19
20 video_id = mobj.group('id')
21 video_extension = 'mp4'
22 webpage = self._download_webpage(url, video_id)
23
24 self.report_extraction(video_id)
25
26 video_url = self._html_search_regex(
27 r'<source src="(.+?)" type="video/mp4">', webpage, u'video URL')
28
29 video_title = self._html_search_regex(
30 r'<h1 class="videoTitle slidePanelMovable">(.+?)</h1>',
31 webpage, u'title')
32
33 # No self-labeling, but they describe themselves as
34 # "Home of Videos Porno"
35 age_limit = 18
36
37 return {
38 'id': video_id,
39 'url': video_url,
40 'ext': video_extension,
41 'title': video_title,
42 'age_limit': age_limit,
43 }