]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pornhd.py
27d65d4b9cdcf1e068b0d6971502eaa0caccf895
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
15 class PornHdIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<id>\d+)(?:/(?P<display_id>.+))?'
18 'url': 'http://www.pornhd.com/videos/9864/selfie-restroom-masturbation-fun-with-chubby-cutie-hd-porn-video',
19 'md5': '87f1540746c1d32ec7a2305c12b96b25',
22 'display_id': 'selfie-restroom-masturbation-fun-with-chubby-cutie-hd-porn-video',
24 'title': 'Restroom selfie masturbation',
25 'description': 'md5:3748420395e03e31ac96857a8f125b2b',
26 'thumbnail': r
're:^https?://.*\.jpg',
33 'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
34 'md5': '956b8ca569f7f4d8ec563e2c41598441',
37 'display_id': 'sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
39 'title': 'Sierra loves doing laundry',
40 'description': 'md5:8ff0523848ac2b8f9b065ba781ccf294',
41 'thumbnail': r
're:^https?://.*\.jpg',
46 'skip': 'Not available anymore',
49 def _real_extract(self
, url
):
50 mobj
= re
.match(self
._VALID
_URL
, url
)
51 video_id
= mobj
.group('id')
52 display_id
= mobj
.group('display_id')
54 webpage
= self
._download
_webpage
(url
, display_id
or video_id
)
56 title
= self
._html
_search
_regex
(
57 [r
'<span[^>]+class=["\']video
-name
["\'][^>]*>([^<]+)',
58 r'<title>(.+?) - .*?[Pp]ornHD.*?</title>'], webpage, 'title')
60 sources = self._parse_json(js_to_json(self._search_regex(
61 r"(?s
)sources
'?\s*[:=]\s*(\{.+?\})",
62 webpage, 'sources
', default='{}')), video_id)
65 message = self._html_search_regex(
66 r'(?s
)<(div|p
)[^
>]+class="no-video"[^
>]*>(?P
<value
>.+?
)</\
1',
67 webpage, 'error message
', group='value
')
68 raise ExtractorError('%s said
: %s' % (self.IE_NAME, message), expected=True)
71 for format_id, video_url in sources.items():
72 video_url = urljoin(url, video_url)
75 height = int_or_none(self._search_regex(
76 r'^
(\d
+)[pP
]', format_id, 'height
', default=None))
79 'ext
': determine_ext(video_url, 'mp4
'),
80 'format_id
': format_id,
83 self._sort_formats(formats)
85 description = self._html_search_regex(
86 r'<(div|p
)[^
>]+class="description"[^
>]*>(?P
<value
>[^
<]+)</\
1',
87 webpage, 'description
', fatal=False, group='value
')
88 view_count = int_or_none(self._html_search_regex(
89 r'(\d
+) views\s
*<', webpage, 'view count
', fatal=False))
90 thumbnail = self._search_regex(
91 r"poster'?\s
*:\s
*([\"'])(?P<url>(?:(?!\1).)+)\1", webpage,
92 'thumbnail
', fatal=False, group='url
')
94 like_count = int_or_none(self._search_regex(
95 (r'(\d
+)\s
*</11[^
>]+>(?
: 
;|\s
)*\blikes
',
96 r'class=["\']save-count["\'][^
>]*>\s
*(\d
+)'),
97 webpage, 'like count
', fatal=False))
101 'display_id
': display_id,
103 'description
': description,
104 'thumbnail
': thumbnail,
105 'view_count
': view_count,
106 'like_count
': like_count,