3 from .common
import InfoExtractor
13 class NuvidIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)'
16 'url': 'https://www.nuvid.com/video/6513023/italian-babe',
17 'md5': '772d2f8288f3d3c5c45f7a41761c7844',
21 'title': 'italian babe',
24 'thumbnail': r
're:https?://.+\.jpg',
27 'url': 'https://m.nuvid.com/video/6523263',
28 'md5': 'ebd22ce8e47e1d9a4d0756a15c67da52',
32 'title': 'Slut brunette college student anal dorm',
35 'thumbnail': r
're:https?://.+\.jpg',
39 'url': 'http://m.nuvid.com/video/6415801/',
40 'md5': '638d5ececb138d5753593f751ae3f697',
44 'title': 'My best friend wanted to fuck my wife for a long time',
47 'thumbnail': r
're:https?://.+\.jpg',
51 def _real_extract(self
, url
):
52 video_id
= self
._match
_id
(url
)
59 json_url
= f
'https://www.nuvid.com/player_config_json/?vid={video_id}&aid=0&domain_id=0&embed=0&check_speed=0'
60 video_data
= self
._download
_json
(
61 json_url
, video_id
, headers
={
62 'Accept': 'application/json, text/javascript, */*; q = 0.01',
63 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
66 webpage
= self
._download
_webpage
(
67 f
'http://m.nuvid.com/video/{video_id}',
68 video_id
, 'Downloading video page', fatal
=False) or ''
70 title
= strip_or_none(video_data
.get('title') or self
._html
_search
_regex
(
71 (r
'''<span\s[^>]*?\btitle\s*=\s*(?P<q>"|'|\b)(?P<title>[^"]+)(?P=q)\s*>''',
72 r
'''<div\s[^>]*?\bclass\s*=\s*(?P<q>"|'|\b)thumb-holder video(?P=q)>\s*<h5\b[^>]*>(?P<title>[^<]+)</h5''',
73 r
'''<span\s[^>]*?\bclass\s*=\s*(?P<q>"|'|\b)title_thumb(?P=q)>(?P<title>[^<]+)</span'''),
74 webpage
, 'title', group
='title'))
78 'format_id': qualities
.get(quality
),
79 'height': int_or_none(qualities
.get(quality
)[:-1]),
80 } for quality
, source
in video_data
.get('files').items() if source
]
82 self
._check
_formats
(formats
, video_id
)
84 duration
= parse_duration(traverse_obj(video_data
, 'duration', 'duration_format'))
86 {'url': thumb_url
} for thumb_url
in re
.findall(
87 r
'<div\s+class\s*=\s*"video-tmb-wrap"\s*>\s*<img\s+src\s*=\s*"([^"]+)"\s*/>', webpage
)
88 if url_or_none(thumb_url
)]
89 if url_or_none(video_data
.get('poster')):
90 thumbnails
.append({'url': video_data
['poster'], 'preference': 1})
96 'thumbnails': thumbnails
,