1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-26 20:22:14 +00:00
youtube-dl/youtube_dl/extractor/empflix.py

55 lines
1.7 KiB
Python
Raw Normal View History

2014-05-13 08:14:05 +00:00
from __future__ import unicode_literals
2014-05-12 11:10:29 +00:00
import re
from .common import InfoExtractor
2014-05-13 08:14:05 +00:00
2014-05-12 11:10:29 +00:00
class EmpflixIE(InfoExtractor):
2014-05-13 08:14:05 +00:00
_VALID_URL = r'^https?://www\.empflix\.com/videos/.*?-(?P<id>[0-9]+)\.html'
2014-05-12 11:10:29 +00:00
_TEST = {
2014-05-13 08:14:05 +00:00
'url': 'http://www.empflix.com/videos/Amateur-Finger-Fuck-33051.html',
2014-05-23 18:06:03 +00:00
'md5': 'b1bc15b6412d33902d6e5952035fcabc',
2014-05-13 08:14:05 +00:00
'info_dict': {
'id': '33051',
2014-05-23 18:06:03 +00:00
'ext': 'mp4',
2014-05-13 08:14:05 +00:00
'title': 'Amateur Finger Fuck',
2014-05-23 18:06:03 +00:00
'description': 'Amateur solo finger fucking.',
2014-05-13 08:14:05 +00:00
'age_limit': 18,
2014-05-12 11:10:29 +00:00
}
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
2014-05-13 08:14:05 +00:00
video_id = mobj.group('id')
2014-05-12 11:10:29 +00:00
webpage = self._download_webpage(url, video_id)
age_limit = self._rta_search(webpage)
2014-05-13 08:14:05 +00:00
video_title = self._html_search_regex(
r'name="title" value="(?P<title>[^"]*)"', webpage, 'title')
2014-05-23 18:06:03 +00:00
video_description = self._html_search_regex(
r'name="description" value="([^"]*)"', webpage, 'description', fatal=False)
2014-05-12 11:10:29 +00:00
2014-05-13 08:14:05 +00:00
cfg_url = self._html_search_regex(
r'flashvars\.config = escape\("([^"]+)"',
webpage, 'flashvars.config')
2014-05-12 11:10:29 +00:00
2014-05-13 08:14:05 +00:00
cfg_xml = self._download_xml(
cfg_url, video_id, note='Downloading metadata')
2014-05-23 18:06:03 +00:00
formats = [
{
'url': item.find('videoLink').text,
'format_id': item.find('res').text,
} for item in cfg_xml.findall('./quality/item')
]
2014-05-12 11:10:29 +00:00
2014-05-13 08:14:05 +00:00
return {
'id': video_id,
'title': video_title,
2014-05-23 18:06:03 +00:00
'description': video_description,
'formats': formats,
2014-05-13 08:14:05 +00:00
'age_limit': age_limit,
}