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