]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/peekvids.py
2d9b9a742513e4d215d96838e5e1524391e8b981
[yt-dlp.git] / yt_dlp / extractor / peekvids.py
1 from .common import InfoExtractor
2
3
4 class PeekVidsIE(InfoExtractor):
5 _VALID_URL = r'''(?x)
6 https?://(?:www\.)?peekvids\.com/
7 (?:(?:[^/?#]+/){2}|embed/?\?(?:[^#]*&)?v=)
8 (?P<id>[^/?&#]*)
9 '''
10 _TESTS = [{
11 'url': 'https://peekvids.com/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp/BSyLMbN0YCd',
12 'md5': 'a00940646c428e232407e3e62f0e8ef5',
13 'info_dict': {
14 'id': 'BSyLMbN0YCd',
15 'title': ' Dane Jones - Cute redhead with perfect tits with Mini Vamp, SEXYhub',
16 'ext': 'mp4',
17 'thumbnail': r're:^https?://.*\.jpg$',
18 'description': 'Watch Dane Jones - Cute redhead with perfect tits with Mini Vamp (7 min), uploaded by SEXYhub.com',
19 'timestamp': 1642579329,
20 'upload_date': '20220119',
21 'duration': 416,
22 'view_count': int,
23 'age_limit': 18,
24 },
25 }]
26 _DOMAIN = 'www.peekvids.com'
27
28 def _real_extract(self, url):
29 video_id = self._match_id(url)
30 webpage = self._download_webpage(url, video_id)
31
32 short_video_id = self._html_search_regex(r'<video [^>]*data-id="(.+?)"', webpage, 'short video ID')
33 srcs = self._download_json(
34 f'https://{self._DOMAIN}/v-alt/{short_video_id}', video_id,
35 note='Downloading list of source files')
36 formats = [{
37 'url': url,
38 'ext': 'mp4',
39 'format_id': name[8:],
40 } for name, url in srcs.items() if len(name) > 8 and name.startswith('data-src')]
41 if not formats:
42 formats = [{'url': url} for url in srcs.values()]
43
44 info = self._search_json_ld(webpage, video_id, expected_type='VideoObject')
45 info.update({
46 'id': video_id,
47 'age_limit': 18,
48 'formats': formats,
49 })
50 return info
51
52
53 class PlayVidsIE(PeekVidsIE): # XXX: Do not subclass from concrete IE
54 _VALID_URL = r'https?://(?:www\.)?playvids\.com/(?:embed/|[^/]{2}/)?(?P<id>[^/?#]*)'
55 _TESTS = [{
56 'url': 'https://www.playvids.com/U3pBrYhsjXM/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp',
57 'md5': 'cd7dfd8a2e815a45402369c76e3c1825',
58 'info_dict': {
59 'id': 'U3pBrYhsjXM',
60 'title': ' Dane Jones - Cute redhead with perfect tits with Mini Vamp, SEXYhub',
61 'ext': 'mp4',
62 'thumbnail': r're:^https?://.*\.jpg$',
63 'description': 'Watch Dane Jones - Cute redhead with perfect tits with Mini Vamp video in HD, uploaded by SEXYhub.com',
64 'timestamp': 1640435839,
65 'upload_date': '20211225',
66 'duration': 416,
67 'view_count': int,
68 'age_limit': 18,
69 },
70 }, {
71 'url': 'https://www.playvids.com/es/U3pBrYhsjXM/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp',
72 'only_matching': True,
73 }, {
74 'url': 'https://www.playvids.com/embed/U3pBrYhsjXM',
75 'only_matching': True,
76 }]
77 _DOMAIN = 'www.playvids.com'