1 from __future__ import unicode_literals
6 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/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
17 'md5': '956b8ca569f7f4d8ec563e2c41598441',
20 'display_id': 'sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
22 'title': 'Sierra loves doing laundry',
23 'description': 'md5:8ff0523848ac2b8f9b065ba781ccf294',
24 'thumbnail': 're:^https?://.*\.jpg',
30 def _real_extract(self, url):
31 mobj = re.match(self._VALID_URL, url)
32 video_id = mobj.group('id')
33 display_id = mobj.group('display_id')
35 webpage = self._download_webpage(url, display_id or video_id)
37 title = self._html_search_regex(
38 [r'<span[^>]+class=["\']video-name["\'][^>]*>([^<]+)',
39 r'<title>(.+?) - .*?[Pp]ornHD.*?</title>'], webpage, 'title')
40 description = self._html_search_regex(
41 r'<(div|p)[^>]+class="description"[^>]*>(?P<value>[^<]+)</\1',
42 webpage, 'description', fatal=False, group='value')
43 view_count = int_or_none(self._html_search_regex(
44 r'(\d+) views\s*<', webpage, 'view count', fatal=False))
45 thumbnail = self._search_regex(
46 r"'poster'\s*:\s*'([^']+)'", webpage, 'thumbnail', fatal=False)
48 sources = json.loads(js_to_json(self._search_regex(
49 r"(?s)'sources'\s*:\s*(\{.+?\})\s*\}[;,)]",
52 for format_id, video_url in sources.items():
55 height = int_or_none(self._search_regex(
56 r'^(\d+)[pP]', format_id, 'height', default=None))
59 'format_id': format_id,
62 self._sort_formats(formats)
66 'display_id': display_id,
68 'description': description,
69 'thumbnail': thumbnail,
70 'view_count': view_count,