]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pornhd.py
57c78ba52a994a9c2aff224470b86b913702241f
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class PornHdIE(InfoExtractor
):
15 _VALID_URL
= r
'http://(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<id>\d+)(?:/(?P<display_id>.+))?'
17 'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
18 'md5': '956b8ca569f7f4d8ec563e2c41598441',
21 'display_id': 'sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
23 'title': 'Sierra loves doing laundry',
24 'description': 'md5:8ff0523848ac2b8f9b065ba781ccf294',
25 'thumbnail': 're:^https?://.*\.jpg',
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 video_id
= mobj
.group('id')
34 display_id
= mobj
.group('display_id')
36 webpage
= self
._download
_webpage
(url
, display_id
or video_id
)
38 title
= self
._html
_search
_regex
(
39 [r
'<span[^>]+class=["\']video
-name
["\'][^>]*>([^<]+)',
40 r'<title>(.+?) - .*?[Pp]ornHD.*?</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
'])
49 sources = json.loads(js_to_json(self._search_regex(
50 r"(?s)'sources
'\s*:\s*(\{.+?\})\s*\}[;,)]",
53 for qname, video_url in sources.items():
59 'quality
': quality(qname),
61 self._sort_formats(formats)
65 'display_id
': display_id,
67 'description
': description,
68 'thumbnail
': thumbnail,
69 'view_count
': view_count,