]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/pornhd.py
1 from .common
import InfoExtractor
12 class PornHdIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<id>\d+)(?:/(?P<display_id>.+))?'
15 'url': 'http://www.pornhd.com/videos/9864/selfie-restroom-masturbation-fun-with-chubby-cutie-hd-porn-video',
16 'md5': '87f1540746c1d32ec7a2305c12b96b25',
19 'display_id': 'selfie-restroom-masturbation-fun-with-chubby-cutie-hd-porn-video',
21 'title': 'Restroom selfie masturbation',
22 'description': 'md5:3748420395e03e31ac96857a8f125b2b',
23 'thumbnail': r
're:^https?://.*\.jpg',
28 'skip': 'HTTP Error 404: Not Found',
30 'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
31 'md5': '1b7b3a40b9d65a8e5b25f7ab9ee6d6de',
34 'display_id': 'sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
36 'title': 'md5:98c6f8b2d9c229d0f0fde47f61a1a759',
37 'description': 'md5:8ff0523848ac2b8f9b065ba781ccf294',
38 'thumbnail': r
're:^https?://.*\.jpg',
45 def _real_extract(self
, url
):
46 mobj
= self
._match
_valid
_url
(url
)
47 video_id
= mobj
.group('id')
48 display_id
= mobj
.group('display_id')
50 webpage
= self
._download
_webpage
(url
, display_id
or video_id
)
52 title
= self
._html
_search
_regex
(
53 [r
'<span[^>]+class=["\']video
-name
["\'][^>]*>([^<]+)',
54 r'<title>(.+?) - .*?[Pp]ornHD.*?</title>'], webpage, 'title')
56 sources = self._parse_json(js_to_json(self._search_regex(
57 r"(?s
)sources
'?\s*[:=]\s*(\{.+?\})",
58 webpage, 'sources
', default='{}')), video_id)
62 entries = self._parse_html5_media_entries(url, webpage, video_id)
66 if not sources and not info:
67 message = self._html_search_regex(
68 r'(?s
)<(div|p
)[^
>]+class="no-video"[^
>]*>(?P
<value
>.+?
)</\
1',
69 webpage, 'error message
', group='value
')
70 raise ExtractorError('%s said
: %s' % (self.IE_NAME, message), expected=True)
73 for format_id, video_url in sources.items():
74 video_url = urljoin(url, video_url)
77 height = int_or_none(self._search_regex(
78 r'^
(\d
+)[pP
]', format_id, 'height
', default=None))
81 'ext
': determine_ext(video_url, 'mp4
'),
82 'format_id
': format_id,
86 info['formats
'] = formats
88 description = self._html_search_regex(
89 (r'(?s
)<section
[^
>]+class=["\']video-description[^>]+>(?P<value>.+?)</section>',
90 r'<(div|p)[^>]+class="description
"[^>]*>(?P<value>[^<]+)</\1'),
91 webpage, 'description', fatal=False,
92 group='value') or self._html_search_meta(
93 'description', webpage, default=None) or self._og_search_description(webpage)
94 view_count = int_or_none(self._html_search_regex(
95 r'(\d+) views\s*<', webpage, 'view count', fatal=False))
96 thumbnail = self._search_regex(
97 r"poster
'?\s*:\s*([\"'])(?P
<url
>(?
:(?
!\
1).)+)\
1", webpage,
98 'thumbnail', default=None, group='url')
100 like_count = int_or_none(self._search_regex(
101 (r'(\d+)</span>\s*likes',
102 r'(\d+)\s*</11[^>]+>(?: |\s)*\blikes',
103 r'class=["\']save
-count
["\'][^>]*>\s*(\d+)'),
104 webpage, 'like count', fatal=False))
106 return merge_dicts(info, {
108 'display_id': display_id,
110 'description': description,
111 'thumbnail': thumbnail,
112 'view_count': view_count,
113 'like_count': like_count,