]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/twentyfourvideo.py
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))/(?: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,
47 def _real_extract(self
, url
):
48 mobj
= re
.match(self
._VALID
_URL
, url
)
49 video_id
= mobj
.group('id')
50 host
= mobj
.group('host')
52 webpage
= self
._download
_webpage
(
53 'http://%s/video/view/%s' % (host
, video_id
), video_id
)
55 title
= self
._og
_search
_title
(webpage
)
56 description
= self
._html
_search
_regex
(
57 r
'<(p|span)[^>]+itemprop="description"[^>]*>(?P<description>[^<]+)</\1>',
58 webpage
, 'description', fatal
=False, group
='description')
59 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
60 duration
= int_or_none(self
._og
_search
_property
(
61 'duration', webpage
, 'duration', fatal
=False))
62 timestamp
= parse_iso8601(self
._search
_regex
(
63 r
'<time[^>]+\bdatetime="([^"]+)"[^>]+itemprop="uploadDate"',
64 webpage
, 'upload date', fatal
=False))
66 uploader
= self
._html
_search
_regex
(
67 r
'class="video-uploaded"[^>]*>\s*<a href="/jsecUser/movies/[^"]+"[^>]*>([^<]+)</a>',
68 webpage
, 'uploader', fatal
=False)
70 view_count
= int_or_none(self
._html
_search
_regex
(
71 r
'<span class="video-views">(\d+) просмотр',
72 webpage
, 'view count', fatal
=False))
73 comment_count
= int_or_none(self
._html
_search
_regex
(
74 r
'<a[^>]+href="#tab-comments"[^>]*>(\d+) комментари',
75 webpage
, 'comment count', default
=None))
79 r
'http://%s/video/xml/%s?mode=init' % (host
, video_id
),
80 video_id
, 'Downloading init XML')
82 video_xml
= self
._download
_xml
(
83 'http://%s/video/xml/%s?mode=play' % (host
, video_id
),
84 video_id
, 'Downloading video XML')
86 video
= xpath_element(video_xml
, './/video', 'video', fatal
=True)
89 'url': xpath_attr(video
, '', 'url', 'video URL', fatal
=True),
92 like_count
= int_or_none(video
.get('ratingPlus'))
93 dislike_count
= int_or_none(video
.get('ratingMinus'))
94 age_limit
= 18 if video
.get('adult') == 'true' else 0
99 'description': description
,
100 'thumbnail': thumbnail
,
101 'uploader': uploader
,
102 'duration': duration
,
103 'timestamp': timestamp
,
104 'view_count': view_count
,
105 'comment_count': comment_count
,
106 'like_count': like_count
,
107 'dislike_count': dislike_count
,
108 'age_limit': age_limit
,