mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 20:30:41 -05:00
Fix metacafe.com downloads for some videos (fixes issue #189)
This commit is contained in:
parent
db7e31b853
commit
c6c555cf8a
1 changed files with 23 additions and 13 deletions
34
youtube-dl
34
youtube-dl
|
@ -1036,20 +1036,30 @@ class MetacafeIE(InfoExtractor):
|
||||||
# Extract URL, uploader and title from webpage
|
# Extract URL, uploader and title from webpage
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
mobj = re.search(r'(?m)&mediaURL=([^&]+)', webpage)
|
mobj = re.search(r'(?m)&mediaURL=([^&]+)', webpage)
|
||||||
if mobj is None:
|
if mobj is not None:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
mediaURL = urllib.unquote(mobj.group(1))
|
||||||
return
|
|
||||||
mediaURL = urllib.unquote(mobj.group(1))
|
|
||||||
|
|
||||||
# Extract gdaKey if available
|
# Extract gdaKey if available
|
||||||
mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)
|
mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
video_url = mediaURL
|
video_url = mediaURL
|
||||||
#self._downloader.trouble(u'ERROR: unable to extract gdaKey')
|
else:
|
||||||
#return
|
gdaKey = mobj.group(1)
|
||||||
|
video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
|
||||||
else:
|
else:
|
||||||
gdaKey = mobj.group(1)
|
mobj = re.search(r' name="flashvars" value="(.*?)"', webpage)
|
||||||
video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
|
if mobj is None:
|
||||||
|
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
||||||
|
return
|
||||||
|
vardict = parse_qs(mobj.group(1))
|
||||||
|
if 'mediaData' not in vardict:
|
||||||
|
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
||||||
|
return
|
||||||
|
mobj = re.search(r'"mediaURL":"(http.*?)","key":"(.*?)"', vardict['mediaData'][0])
|
||||||
|
if mobj is None:
|
||||||
|
self._downloader.trouble(u'ERROR: unable to extract media URL')
|
||||||
|
return
|
||||||
|
video_url = '%s?__gda__=%s' % (mobj.group(1).replace('\\/', '/'), mobj.group(2))
|
||||||
|
|
||||||
mobj = re.search(r'(?im)<title>(.*) - Video</title>', webpage)
|
mobj = re.search(r'(?im)<title>(.*) - Video</title>', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
|
|
Loading…
Reference in a new issue