2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class TwentyFourVideoIE(InfoExtractor):
17 _VALID_URL = r'https?://(?P<host>(?:www\.)?24video\.(?:net|me|xxx|sexy?|tube|adult|site))/(?:video/(?:view|xml)/|player/new24_play\.swf\?id=)(?P<id>\d+)'
20 'url': 'http://www.24video.net/video/view/1044982',
21 'md5': 'e09fc0901d9eaeedac872f154931deeb',
25 'title': 'Эротика каменного века',
26 'description': 'Как смотрели порно в каменном веке.',
27 'thumbnail': r're:^https?://.*\.jpg$',
28 'uploader': 'SUPERTELO',
30 'timestamp': 1275937857,
31 'upload_date': '20100607',
37 'url': 'http://www.24video.net/player/new24_play.swf?id=1044982',
38 'only_matching': True,
40 'url': 'http://www.24video.me/video/view/1044982',
41 'only_matching': True,
43 'url': 'http://www.24video.tube/video/view/2363750',
44 'only_matching': True,
46 'url': 'https://www.24video.site/video/view/2640421',
47 'only_matching': True,
50 def _real_extract(self, url):
51 mobj = re.match(self._VALID_URL, url)
52 video_id = mobj.group('id')
53 host = mobj.group('host')
55 webpage = self._download_webpage(
56 'http://%s/video/view/%s' % (host, video_id), video_id)
58 title = self._og_search_title(webpage)
59 description = self._html_search_regex(
60 r'<(p|span)[^>]+itemprop="description"[^>]*>(?P<description>[^<]+)</\1>',
61 webpage, 'description', fatal=False, group='description')
62 thumbnail = self._og_search_thumbnail(webpage)
63 duration = int_or_none(self._og_search_property(
64 'duration', webpage, 'duration', fatal=False))
65 timestamp = parse_iso8601(self._search_regex(
66 r'<time[^>]+\bdatetime="([^"]+)"[^>]+itemprop="uploadDate"',
67 webpage, 'upload date', fatal=False))
69 uploader = self._html_search_regex(
70 r'class="video-uploaded"[^>]*>\s*<a href="/jsecUser/movies/[^"]+"[^>]*>([^<]+)</a>',
71 webpage, 'uploader', fatal=False)
73 view_count = int_or_none(self._html_search_regex(
74 r'<span class="video-views">(\d+) просмотр',
75 webpage, 'view count', fatal=False))
76 comment_count = int_or_none(self._html_search_regex(
77 r'<a[^>]+href="#tab-comments"[^>]*>(\d+) комментари',
78 webpage, 'comment count', default=None))
82 r'http://%s/video/xml/%s?mode=init' % (host, video_id),
83 video_id, 'Downloading init XML')
85 video_xml = self._download_xml(
86 'http://%s/video/xml/%s?mode=play' % (host, video_id),
87 video_id, 'Downloading video XML')
89 video = xpath_element(video_xml, './/video', 'video', fatal=True)
92 'url': xpath_attr(video, '', 'url', 'video URL', fatal=True),
95 like_count = int_or_none(video.get('ratingPlus'))
96 dislike_count = int_or_none(video.get('ratingMinus'))
97 age_limit = 18 if video.get('adult') == 'true' else 0
102 'description': description,
103 'thumbnail': thumbnail,
104 'uploader': uploader,
105 'duration': duration,
106 'timestamp': timestamp,
107 'view_count': view_count,
108 'comment_count': comment_count,
109 'like_count': like_count,
110 'dislike_count': dislike_count,
111 'age_limit': age_limit,