]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/redtube.py
debian/changelog: Annotate with bugs being closed.
[youtubedl] / youtube_dl / extractor / redtube.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import ExtractorError
5
6
7 class RedTubeIE(InfoExtractor):
8 _VALID_URL = r'http://(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
9 _TEST = {
10 'url': 'http://www.redtube.com/66418',
11 'md5': '7b8c22b5e7098a3e1c09709df1126d2d',
12 'info_dict': {
13 'id': '66418',
14 'ext': 'mp4',
15 'title': 'Sucked on a toilet',
16 'age_limit': 18,
17 }
18 }
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 webpage = self._download_webpage(url, video_id)
23
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
27 video_url = self._html_search_regex(
28 r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL')
29 video_title = self._html_search_regex(
30 r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
31 webpage, 'title')
32 video_thumbnail = self._og_search_thumbnail(webpage)
33
34 # No self-labeling, but they describe themselves as
35 # "Home of Videos Porno"
36 age_limit = 18
37
38 return {
39 'id': video_id,
40 'url': video_url,
41 'ext': 'mp4',
42 'title': video_title,
43 'thumbnail': video_thumbnail,
44 'age_limit': age_limit,
45 }