mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-03 08:19:57 +01:00
[metacafe] Avoid excessive nesting
This commit is contained in:
parent
12c3ec3382
commit
c15235cd07
@ -134,6 +134,7 @@ def _real_extract(self, url):
|
||||
|
||||
# Extract URL, uploader and title from webpage
|
||||
self.report_extraction(video_id)
|
||||
video_url = None
|
||||
mobj = re.search(r'(?m)&mediaURL=([^&]+)', webpage)
|
||||
if mobj is not None:
|
||||
mediaURL = compat_urllib_parse.unquote(mobj.group(1))
|
||||
@ -146,14 +147,16 @@ def _real_extract(self, url):
|
||||
else:
|
||||
gdaKey = mobj.group(1)
|
||||
video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
|
||||
else:
|
||||
if video_url is None:
|
||||
mobj = re.search(r'<video src="([^"]+)"', webpage)
|
||||
if mobj:
|
||||
video_url = mobj.group(1)
|
||||
video_ext = 'mp4'
|
||||
else:
|
||||
if video_url is None:
|
||||
flashvars = self._search_regex(
|
||||
r' name="flashvars" value="(.*?)"', webpage, 'flashvars')
|
||||
r' name="flashvars" value="(.*?)"', webpage, 'flashvars',
|
||||
default=None)
|
||||
if flashvars:
|
||||
vardict = compat_parse_qs(flashvars)
|
||||
if 'mediaData' not in vardict:
|
||||
raise ExtractorError('Unable to extract media URL')
|
||||
@ -165,6 +168,7 @@ def _real_extract(self, url):
|
||||
video_url = '%s?__gda__=%s' % (mediaURL, mobj.group('key'))
|
||||
video_ext = determine_ext(video_url)
|
||||
|
||||
|
||||
video_title = self._html_search_regex(
|
||||
r'(?im)<title>(.*) - Video</title>', webpage, 'title')
|
||||
description = self._og_search_description(webpage)
|
||||
|
Loading…
Reference in New Issue
Block a user