1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-23 02:23:01 +08:00
youtube-dl/youtube_dl/extractor/pornhd.py

39 lines
1.2 KiB
Python
Raw Normal View History

2013-12-14 11:22:53 +08:00
import re
from .common import InfoExtractor
from ..utils import compat_urllib_parse
2013-12-16 12:10:42 +08:00
2013-12-14 11:22:53 +08:00
class PornHdIE(InfoExtractor):
_VALID_URL = r'(?:http://)?(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<video_id>[0-9]+)/(?P<video_title>.+)'
2013-12-14 11:22:53 +08:00
_TEST = {
u'url': u'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
2013-12-16 12:10:42 +08:00
u'file': u'1962.flv',
u'md5': u'35272469887dca97abd30abecc6cdf75',
2013-12-14 11:22:53 +08:00
u'info_dict': {
u"title": u"sierra-day-gets-his-cum-all-over-herself-hd-porn-video",
u"age_limit": 18,
}
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('video_id')
video_title = mobj.group('video_title')
webpage = self._download_webpage(url, video_id)
video_url = self._html_search_regex(
r'&hd=(http.+?)&', webpage, u'video URL')
video_url = compat_urllib_parse.unquote(video_url)
age_limit = 18
return {
2013-12-16 12:10:42 +08:00
'id': video_id,
'url': video_url,
'ext': 'flv',
'title': video_title,
2013-12-14 11:22:53 +08:00
'age_limit': age_limit,
}