]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/twentyfourvideo.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class TwentyFourVideoIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?24video\.net/(?:video/(?:view|xml)/|player/new24_play\.swf\?id=)(?P<id>\d+)'
19 'url': 'http://www.24video.net/video/view/1044982',
20 'md5': 'e09fc0901d9eaeedac872f154931deeb',
24 'title': 'Эротика каменного века',
25 'description': 'Как смотрели порно в каменном веке.',
26 'thumbnail': 're:^https?://.*\.jpg$',
27 'uploader': 'SUPERTELO',
29 'timestamp': 1275937857,
30 'upload_date': '20100607',
37 'url': 'http://www.24video.net/player/new24_play.swf?id=1044982',
38 'only_matching': True,
42 def _real_extract(self
, url
):
43 video_id
= self
._match
_id
(url
)
45 webpage
= self
._download
_webpage
(
46 'http://www.24video.net/video/view/%s' % video_id
, video_id
)
48 title
= self
._og
_search
_title
(webpage
)
49 description
= self
._html
_search
_regex
(
50 r
'<span itemprop="description">([^<]+)</span>', webpage
, 'description', fatal
=False)
51 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
52 duration
= int_or_none(self
._og
_search
_property
(
53 'duration', webpage
, 'duration', fatal
=False))
54 timestamp
= parse_iso8601(self
._search
_regex
(
55 r
'<time id="video-timeago" datetime="([^"]+)" itemprop="uploadDate">',
56 webpage
, 'upload date'))
58 uploader
= self
._html
_search
_regex
(
59 r
'class="video-uploaded"[^>]*>\s*<a href="/jsecUser/movies/[^"]+"[^>]*>([^<]+)</a>',
60 webpage
, 'uploader', fatal
=False)
62 view_count
= int_or_none(self
._html
_search
_regex
(
63 r
'<span class="video-views">(\d+) просмотр',
64 webpage
, 'view count', fatal
=False))
65 comment_count
= int_or_none(self
._html
_search
_regex
(
66 r
'<div class="comments-title" id="comments-count">(\d+) комментари',
67 webpage
, 'comment count', fatal
=False))
71 r
'http://www.24video.net/video/xml/%s?mode=init' % video_id
,
72 video_id
, 'Downloading init XML')
74 video_xml
= self
._download
_xml
(
75 'http://www.24video.net/video/xml/%s?mode=play' % video_id
,
76 video_id
, 'Downloading video XML')
78 video
= xpath_element(video_xml
, './/video', 'video', fatal
=True)
81 'url': xpath_attr(video
, '', 'url', 'video URL', fatal
=True),
84 like_count
= int_or_none(video
.get('ratingPlus'))
85 dislike_count
= int_or_none(video
.get('ratingMinus'))
86 age_limit
= 18 if video
.get('adult') == 'true' else 0
91 'description': description
,
92 'thumbnail': thumbnail
,
95 'timestamp': timestamp
,
96 'view_count': view_count
,
97 'comment_count': comment_count
,
98 'like_count': like_count
,
99 'dislike_count': dislike_count
,
100 'age_limit': age_limit
,