]>
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
):
20 (?:(?:www|porno)\.)?24video\.
21 (?:net|me|xxx|sexy?|tube|adult|site|vip)
24 video/(?:(?:view|xml)/)?|
25 player/new24_play\.swf\?id=
31 'url': 'http://www.24video.net/video/view/1044982',
32 'md5': 'e09fc0901d9eaeedac872f154931deeb',
36 'title': 'Эротика каменного века',
37 'description': 'Как смотрели порно в каменном веке.',
38 'thumbnail': r
're:^https?://.*\.jpg$',
39 'uploader': 'SUPERTELO',
41 'timestamp': 1275937857,
42 'upload_date': '20100607',
48 'url': 'http://www.24video.net/player/new24_play.swf?id=1044982',
49 'only_matching': True,
51 'url': 'http://www.24video.me/video/view/1044982',
52 'only_matching': True,
54 'url': 'http://www.24video.tube/video/view/2363750',
55 'only_matching': True,
57 'url': 'https://www.24video.site/video/view/2640421',
58 'only_matching': True,
60 'url': 'https://porno.24video.net/video/2640421-vsya-takaya-gibkaya-i-v-masle',
61 'only_matching': True,
63 'url': 'https://www.24video.vip/video/view/1044982',
64 'only_matching': True,
67 def _real_extract(self
, url
):
68 mobj
= re
.match(self
._VALID
_URL
, url
)
69 video_id
= mobj
.group('id')
70 host
= mobj
.group('host')
72 webpage
= self
._download
_webpage
(
73 'http://%s/video/view/%s' % (host
, video_id
), video_id
)
75 title
= self
._og
_search
_title
(webpage
)
76 description
= self
._html
_search
_regex
(
77 r
'<(p|span)[^>]+itemprop="description"[^>]*>(?P<description>[^<]+)</\1>',
78 webpage
, 'description', fatal
=False, group
='description')
79 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
80 duration
= int_or_none(self
._og
_search
_property
(
81 'duration', webpage
, 'duration', fatal
=False))
82 timestamp
= parse_iso8601(self
._search
_regex
(
83 r
'<time[^>]+\bdatetime="([^"]+)"[^>]+itemprop="uploadDate"',
84 webpage
, 'upload date', fatal
=False))
86 uploader
= self
._html
_search
_regex
(
87 r
'class="video-uploaded"[^>]*>\s*<a href="/jsecUser/movies/[^"]+"[^>]*>([^<]+)</a>',
88 webpage
, 'uploader', fatal
=False)
90 view_count
= int_or_none(self
._html
_search
_regex
(
91 r
'<span class="video-views">(\d+) просмотр',
92 webpage
, 'view count', fatal
=False))
93 comment_count
= int_or_none(self
._html
_search
_regex
(
94 r
'<a[^>]+href="#tab-comments"[^>]*>(\d+) комментари',
95 webpage
, 'comment count', default
=None))
99 r
'http://%s/video/xml/%s?mode=init' % (host
, video_id
),
100 video_id
, 'Downloading init XML')
102 video_xml
= self
._download
_xml
(
103 'http://%s/video/xml/%s?mode=play' % (host
, video_id
),
104 video_id
, 'Downloading video XML')
106 video
= xpath_element(video_xml
, './/video', 'video', fatal
=True)
109 'url': xpath_attr(video
, '', 'url', 'video URL', fatal
=True),
112 like_count
= int_or_none(video
.get('ratingPlus'))
113 dislike_count
= int_or_none(video
.get('ratingMinus'))
114 age_limit
= 18 if video
.get('adult') == 'true' else 0
119 'description': description
,
120 'thumbnail': thumbnail
,
121 'uploader': uploader
,
122 'duration': duration
,
123 'timestamp': timestamp
,
124 'view_count': view_count
,
125 'comment_count': comment_count
,
126 'like_count': like_count
,
127 'dislike_count': dislike_count
,
128 'age_limit': age_limit
,