]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/sexu.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class SexuIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?sexu\.com/(?P<id>\d+)'
11 'url': 'http://sexu.com/961791/',
12 'md5': 'ff615aca9691053c94f8f10d96cd7884',
17 'description': 'md5:c5ed8625eb386855d5a7967bd7b77a54',
18 'categories': list, # NSFW
19 'thumbnail': 're:https?://.*\.jpg$',
24 def _real_extract(self
, url
):
25 mobj
= re
.match(self
._VALID
_URL
, url
)
26 video_id
= mobj
.group('id')
28 webpage
= self
._download
_webpage
(url
, video_id
)
30 quality_arr
= self
._search
_regex
(r
'sources:\s*\[([^\]]+)\]', webpage
, 'quality formats')
33 'url': fmt
[0].replace('\\', ''),
35 'height': int(fmt
[1][:3]),
36 } for fmt
in re
.findall(r
'"file":"([^"]+)","label":"([^"]+)"', quality_arr
)]
37 self
._sort
_formats
(formats
)
39 title
= self
._html
_search
_regex
(
40 r
'<title>([^<]+)\s*-\s*Sexu.Com</title>', webpage
, 'title')
42 description
= self
._html
_search
_meta
('description', webpage
, 'description')
44 thumbnail
= self
._html
_search
_regex
(
45 r
'image:\s*"([^"]+)"',
46 webpage
, 'thumbnail', fatal
=False)
48 categories_str
= self
._html
_search
_meta
('keywords', webpage
, 'categories', fatal
=False)
50 None if categories_str
is None
51 else categories_str
.split(','))
56 'description': description
,
57 'thumbnail': thumbnail
,
58 'categories': categories
,