1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
10 class PornHdIE(InfoExtractor):
11 _VALID_URL = r'http://(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<id>\d+)'
13 'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
14 'md5': '956b8ca569f7f4d8ec563e2c41598441',
18 'title': 'Sierra loves doing laundry',
19 'description': 'md5:8ff0523848ac2b8f9b065ba781ccf294',
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
28 webpage = self._download_webpage(url, video_id)
30 title = self._html_search_regex(
31 r'<title>(.+) porn HD.+?</title>', webpage, 'title')
32 description = self._html_search_regex(
33 r'<div class="description">([^<]+)</div>', webpage, 'description', fatal=False)
34 view_count = int_or_none(self._html_search_regex(
35 r'(\d+) views\s*</span>', webpage, 'view count', fatal=False))
38 r'var __video([\da-zA-Z]+?)(Low|High)StreamUrl = \'(http://.+?)\?noProxy=1\'', webpage)
40 mobj = re.search(r'flashVars = (?P<flashvars>{.+?});', webpage)
42 flashvars = json.loads(mobj.group('flashvars'))
43 for key, quality in [('hashlink', 'low'), ('hd', 'high')]:
44 redirect_url = flashvars.get(key)
46 videos.append(('flv', quality, redirect_url))
47 thumbnail = flashvars['urlWallpaper']
49 thumbnail = self._og_search_thumbnail(webpage)
52 for format_, quality, redirect_url in videos:
53 format_id = '%s-%s' % (format_.lower(), quality.lower())
54 video_url = self._download_webpage(
55 redirect_url, video_id, 'Downloading %s video link' % format_id, fatal=False)
60 'ext': format_.lower(),
61 'format_id': format_id,
62 'quality': 1 if quality.lower() == 'high' else 0,
64 self._sort_formats(formats)
69 'description': description,
70 'thumbnail': thumbnail,
71 'view_count': view_count,