0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-23 02:25:11 +00:00

[metacafe] Simplify

This commit is contained in:
Philipp Hagemeister 2014-08-21 13:25:17 +02:00
parent 55db73efdf
commit 12c3ec3382

View file

@ -152,10 +152,9 @@ def _real_extract(self, url):
video_url = mobj.group(1) video_url = mobj.group(1)
video_ext = 'mp4' video_ext = 'mp4'
else: else:
mobj = re.search(r' name="flashvars" value="(.*?)"', webpage) flashvars = self._search_regex(
if mobj is None: r' name="flashvars" value="(.*?)"', webpage, 'flashvars')
raise ExtractorError('Unable to extract media URL') vardict = compat_parse_qs(flashvars)
vardict = compat_parse_qs(mobj.group(1))
if 'mediaData' not in vardict: if 'mediaData' not in vardict:
raise ExtractorError('Unable to extract media URL') raise ExtractorError('Unable to extract media URL')
mobj = re.search( mobj = re.search(
@ -166,7 +165,8 @@ def _real_extract(self, url):
video_url = '%s?__gda__=%s' % (mediaURL, mobj.group('key')) video_url = '%s?__gda__=%s' % (mediaURL, mobj.group('key'))
video_ext = determine_ext(video_url) video_ext = determine_ext(video_url)
video_title = self._html_search_regex(r'(?im)<title>(.*) - Video</title>', webpage, 'title') video_title = self._html_search_regex(
r'(?im)<title>(.*) - Video</title>', webpage, 'title')
description = self._og_search_description(webpage) description = self._og_search_description(webpage)
thumbnail = self._og_search_thumbnail(webpage) thumbnail = self._og_search_thumbnail(webpage)
video_uploader = self._html_search_regex( video_uploader = self._html_search_regex(
@ -184,7 +184,7 @@ def _real_extract(self, url):
'description': description, 'description': description,
'uploader': video_uploader, 'uploader': video_uploader,
'title': video_title, 'title': video_title,
'thumbnail':thumbnail, 'thumbnail': thumbnail,
'ext': video_ext, 'ext': video_ext,
'age_limit': age_limit, 'age_limit': age_limit,
} }