]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/redtube.py
846b76c81528431c0faf8ea3fc9bbd6b017db099
[youtubedl] / youtube_dl / extractor / redtube.py
1 from __future__ import unicode_literals
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 'url': 'http://www.redtube.com/66418',
10 'info_dict': {
11 'id': '66418',
12 'ext': 'mp4',
13 "title": "Sucked on a toilet",
14 "age_limit": 18,
15 }
16 }
17
18 def _real_extract(self, url):
19 video_id = self._match_id(url)
20 webpage = self._download_webpage(url, video_id)
21
22 video_url = self._html_search_regex(
23 r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL')
24 video_title = self._html_search_regex(
25 r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
26 webpage, 'title')
27 video_thumbnail = self._og_search_thumbnail(webpage)
28
29 # No self-labeling, but they describe themselves as
30 # "Home of Videos Porno"
31 age_limit = 18
32
33 return {
34 'id': video_id,
35 'url': video_url,
36 'ext': 'mp4',
37 'title': video_title,
38 'thumbnail': video_thumbnail,
39 'age_limit': age_limit,
40 }