yt-dlc/youtube_dl/extractor/pornhd.py

45 lines
1.3 KiB
Python
Raw Normal View History

2014-01-28 02:53:00 +00:00
from __future__ import unicode_literals
2013-12-14 03:22:53 +00:00
import re
from .common import InfoExtractor
from ..utils import compat_urllib_parse
2013-12-16 04:10:42 +00:00
2013-12-14 03:22:53 +00: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 03:22:53 +00:00
_TEST = {
2014-01-28 02:53:00 +00:00
'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
'file': '1962.flv',
'md5': '35272469887dca97abd30abecc6cdf75',
'info_dict': {
"title": "sierra-day-gets-his-cum-all-over-herself-hd-porn-video",
"age_limit": 18,
2013-12-14 03:22:53 +00:00
}
}
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)
2014-01-28 02:53:00 +00:00
next_url = self._html_search_regex(
r'&hd=(http.+?)&', webpage, 'video URL')
next_url = compat_urllib_parse.unquote(next_url)
video_url = self._download_webpage(
next_url, video_id, note='Retrieving video URL',
errnote='Could not retrieve video URL')
2013-12-14 03:22:53 +00:00
age_limit = 18
return {
2013-12-16 04:10:42 +00:00
'id': video_id,
'url': video_url,
'ext': 'flv',
'title': video_title,
2013-12-14 03:22:53 +00:00
'age_limit': age_limit,
}