]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pornhd.py
e9ff8d1af893c8e22830bbfd41d37b56d5815c9a
[youtubedl] / youtube_dl / extractor / pornhd.py
1 import re
2
3 from .common import InfoExtractor
4 from ..utils import compat_urllib_parse
5
6
7 class PornHdIE(InfoExtractor):
8 _VALID_URL = r'(?:http://)?(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<video_id>[0-9]+)/(?P<video_title>.+)'
9 _TEST = {
10 u'url': u'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
11 u'file': u'1962.flv',
12 u'md5': u'35272469887dca97abd30abecc6cdf75',
13 u'info_dict': {
14 u"title": u"sierra-day-gets-his-cum-all-over-herself-hd-porn-video",
15 u"age_limit": 18,
16 }
17 }
18
19 def _real_extract(self, url):
20 mobj = re.match(self._VALID_URL, url)
21
22 video_id = mobj.group('video_id')
23 video_title = mobj.group('video_title')
24
25 webpage = self._download_webpage(url, video_id)
26
27 video_url = self._html_search_regex(
28 r'&hd=(http.+?)&', webpage, u'video URL')
29 video_url = compat_urllib_parse.unquote(video_url)
30 age_limit = 18
31
32 return {
33 'id': video_id,
34 'url': video_url,
35 'ext': 'flv',
36 'title': video_title,
37 'age_limit': age_limit,
38 }