]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pornhd.py
bac484c67dbb01bbafa319c117b7c6d152b7dd5d
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
15 class PornHdIE(InfoExtractor
):
16 _VALID_URL
= r
'http://(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<id>\d+)(?:/(?P<display_id>.+))?'
18 'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
19 'md5': '956b8ca569f7f4d8ec563e2c41598441',
22 'display_id': 'sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
24 'title': 'Sierra loves doing laundry',
25 'description': 'md5:8ff0523848ac2b8f9b065ba781ccf294',
26 'thumbnail': 're:^https?://.*\.jpg',
32 def _real_extract(self
, url
):
33 mobj
= re
.match(self
._VALID
_URL
, url
)
34 video_id
= mobj
.group('id')
35 display_id
= mobj
.group('display_id')
37 webpage
= self
._download
_webpage
(url
, display_id
or video_id
)
39 title
= self
._html
_search
_regex
(
40 r
'<title>(.+) porn HD.+?</title>', webpage
, 'title')
41 description
= self
._html
_search
_regex
(
42 r
'<div class="description">([^<]+)</div>', webpage
, 'description', fatal
=False)
43 view_count
= int_or_none(self
._html
_search
_regex
(
44 r
'(\d+) views\s*</span>', webpage
, 'view count', fatal
=False))
45 thumbnail
= self
._search
_regex
(
46 r
"'poster'\s*:\s*'([^']+)'", webpage
, 'thumbnail', fatal
=False)
48 quality
= qualities(['SD', 'HD'])
50 'url': source
['file'],
51 'format_id': '%s-%s' % (source
['label'], determine_ext(source
['file'])),
52 'quality': quality(source
['label']),
53 } for source
in json
.loads(js_to_json(self
._search
_regex
(
54 r
"(?s)'sources'\s*:\s*(\[.+?\])", webpage
, 'sources')))]
55 self
._sort
_formats
(formats
)
59 'display_id': display_id
,
61 'description': description
,
62 'thumbnail': thumbnail
,
63 'view_count': view_count
,