]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pornhd.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class PornHdIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<id>\d+)(?:/(?P<display_id>.+))?'
16 'url': 'http://www.pornhd.com/videos/9864/selfie-restroom-masturbation-fun-with-chubby-cutie-hd-porn-video',
17 'md5': 'c8b964b1f0a4b5f7f28ae3a5c9f86ad5',
20 'display_id': 'selfie-restroom-masturbation-fun-with-chubby-cutie-hd-porn-video',
22 'title': 'Restroom selfie masturbation',
23 'description': 'md5:3748420395e03e31ac96857a8f125b2b',
24 'thumbnail': r
're:^https?://.*\.jpg',
30 'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
31 'md5': '956b8ca569f7f4d8ec563e2c41598441',
34 'display_id': 'sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
36 'title': 'Sierra loves doing laundry',
37 'description': 'md5:8ff0523848ac2b8f9b065ba781ccf294',
38 'thumbnail': r
're:^https?://.*\.jpg',
42 'skip': 'Not available anymore',
45 def _real_extract(self
, url
):
46 mobj
= re
.match(self
._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)
61 message = self._html_search_regex(
62 r'(?s
)<(div|p
)[^
>]+class="no-video"[^
>]*>(?P
<value
>.+?
)</\
1',
63 webpage, 'error message
', group='value
')
64 raise ExtractorError('%s said
: %s' % (self.IE_NAME, message), expected=True)
67 for format_id, video_url in sources.items():
70 height = int_or_none(self._search_regex(
71 r'^
(\d
+)[pP
]', format_id, 'height
', default=None))
74 'format_id
': format_id,
77 self._sort_formats(formats)
79 description = self._html_search_regex(
80 r'<(div|p
)[^
>]+class="description"[^
>]*>(?P
<value
>[^
<]+)</\
1',
81 webpage, 'description
', fatal=False, group='value
')
82 view_count = int_or_none(self._html_search_regex(
83 r'(\d
+) views\s
*<', webpage, 'view count
', fatal=False))
84 thumbnail = self._search_regex(
85 r"poster'?\s
*:\s
*([\"'])(?P<url>(?:(?!\1).)+)\1", webpage,
86 'thumbnail
', fatal=False, group='url
')
90 'display_id
': display_id,
92 'description
': description,
93 'thumbnail
': thumbnail,
94 'view_count
': view_count,