]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/redtube.py
Add support for https for all extractors as preventive and future-proof measure
[yt-dlp.git] / youtube_dl / extractor / redtube.py
CommitLineData
032b3df5
PH
1from __future__ import unicode_literals
2
9f5daf00 3from .common import InfoExtractor
2676caf3 4from ..utils import ExtractorError
9f5daf00
PH
5
6
7class RedTubeIE(InfoExtractor):
5886b38d 8 _VALID_URL = r'https?://(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
6f5ac90c 9 _TEST = {
032b3df5 10 'url': 'http://www.redtube.com/66418',
838b9340 11 'md5': '7b8c22b5e7098a3e1c09709df1126d2d',
032b3df5 12 'info_dict': {
faf34948
PH
13 'id': '66418',
14 'ext': 'mp4',
838b9340
S
15 'title': 'Sucked on a toilet',
16 'age_limit': 18,
6f5ac90c
PH
17 }
18 }
9f5daf00 19
cd214418 20 def _real_extract(self, url):
faf34948 21 video_id = self._match_id(url)
9f5daf00
PH
22 webpage = self._download_webpage(url, video_id)
23
2676caf3
S
24 if any(s in webpage for s in ['video-deleted-info', '>This video has been removed']):
25 raise ExtractorError('Video %s has been removed' % video_id, expected=True)
26
cd214418 27 video_url = self._html_search_regex(
faf34948 28 r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL')
cd214418 29 video_title = self._html_search_regex(
938384c5 30 r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
faf34948 31 webpage, 'title')
530ed178 32 video_thumbnail = self._og_search_thumbnail(webpage)
9d11a41f 33
1310bf24
PH
34 # No self-labeling, but they describe themselves as
35 # "Home of Videos Porno"
36 age_limit = 18
37
cd214418 38 return {
032b3df5
PH
39 'id': video_id,
40 'url': video_url,
faf34948 41 'ext': 'mp4',
032b3df5 42 'title': video_title,
9d11a41f 43 'thumbnail': video_thumbnail,
1310bf24 44 'age_limit': age_limit,
cd214418 45 }