]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/twentyfourvideo.py
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 pc_video
= self
._download
_xml
(
70 'http://www.24video.net/video/xml/%s?mode=play' % video_id
,
71 video_id
, 'Downloading PC video URL').find('.//video')
74 'url': pc_video
.attrib
['url'],
79 like_count
= int_or_none(pc_video
.get('ratingPlus'))
80 dislike_count
= int_or_none(pc_video
.get('ratingMinus'))
81 age_limit
= 18 if pc_video
.get('adult') == 'true' else 0
83 mobile_video
= self
._download
_xml
(
84 'http://www.24video.net/video/xml/%s' % video_id
,
85 video_id
, 'Downloading mobile video URL').find('.//video')
88 'url': mobile_video
.attrib
['url'],
89 'format_id': 'mobile',
93 self
._sort
_formats
(formats
)
98 'description': description
,
99 'thumbnail': thumbnail
,
100 'uploader': uploader
,
101 'duration': duration
,
102 'timestamp': timestamp
,
103 'view_count': view_count
,
104 'comment_count': comment_count
,
105 'like_count': like_count
,
106 'dislike_count': dislike_count
,
107 'age_limit': age_limit
,