2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class TwentyFourVideoIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?24video\.net/(?:video/(?:view|xml)/|player/new24_play\.swf\?id=)(?P<id>\d+)'
17 'url': 'http://www.24video.net/video/view/1044982',
18 'md5': 'd041af8b5b4246ea466226a0d6693345',
22 'title': 'Эротика каменного века',
23 'description': 'Как смотрели порно в каменном веке.',
24 'thumbnail': 're:^https?://.*\.jpg$',
25 'uploader': 'SUPERTELO',
27 'timestamp': 1275937857,
28 'upload_date': '20100607',
35 'url': 'http://www.24video.net/player/new24_play.swf?id=1044982',
36 'only_matching': True,
40 def _real_extract(self, url):
41 video_id = self._match_id(url)
43 webpage = self._download_webpage(
44 'http://www.24video.net/video/view/%s' % video_id, video_id)
46 title = self._og_search_title(webpage)
47 description = self._html_search_regex(
48 r'<span itemprop="description">([^<]+)</span>', webpage, 'description', fatal=False)
49 thumbnail = self._og_search_thumbnail(webpage)
50 duration = int_or_none(self._og_search_property(
51 'duration', webpage, 'duration', fatal=False))
52 timestamp = parse_iso8601(self._search_regex(
53 r'<time id="video-timeago" datetime="([^"]+)" itemprop="uploadDate">',
54 webpage, 'upload date'))
56 uploader = self._html_search_regex(
57 r'class="video-uploaded"[^>]*>\s*<a href="/jsecUser/movies/[^"]+"[^>]*>([^<]+)</a>',
58 webpage, 'uploader', fatal=False)
60 view_count = int_or_none(self._html_search_regex(
61 r'<span class="video-views">(\d+) просмотр',
62 webpage, 'view count', fatal=False))
63 comment_count = int_or_none(self._html_search_regex(
64 r'<div class="comments-title" id="comments-count">(\d+) комментари',
65 webpage, 'comment count', fatal=False))
69 r'http://www.24video.net/video/xml/%s?mode=init' % video_id,
70 video_id, 'Downloading init XML')
72 video = self._download_xml(
73 'http://www.24video.net/video/xml/%s?mode=play' % video_id,
74 video_id, 'Downloading video XML').find('.//video')
77 'url': video.attrib['url'],
80 like_count = int_or_none(video.get('ratingPlus'))
81 dislike_count = int_or_none(video.get('ratingMinus'))
82 age_limit = 18 if video.get('adult') == 'true' else 0
87 'description': description,
88 'thumbnail': thumbnail,
91 'timestamp': timestamp,
92 'view_count': view_count,
93 'comment_count': comment_count,
94 'like_count': like_count,
95 'dislike_count': dislike_count,
96 'age_limit': age_limit,