mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-04-25 18:46:54 +00:00
Fix KeyError('50') in Google Drive extractor by adding safe extension lookup
This commit is contained in:
parent
711e72c292
commit
b5f1fcb5f9
@ -187,23 +187,29 @@ class GoogleDriveIE(InfoExtractor):
|
|||||||
resolutions[mobj.group('format_id')] = (
|
resolutions[mobj.group('format_id')] = (
|
||||||
int(mobj.group('width')), int(mobj.group('height')))
|
int(mobj.group('width')), int(mobj.group('height')))
|
||||||
|
|
||||||
for fmt_stream in fmt_stream_map:
|
for fmt_stream in fmt_stream_map:
|
||||||
fmt_stream_split = fmt_stream.split('|')
|
fmt_stream_split = fmt_stream.split('|')
|
||||||
if len(fmt_stream_split) < 2:
|
if len(fmt_stream_split) < 2:
|
||||||
continue
|
continue
|
||||||
format_id, format_url = fmt_stream_split[:2]
|
format_id, format_url = fmt_stream_split[:2]
|
||||||
f = {
|
# Try to get the extension from the known formats
|
||||||
'url': lowercase_escape(format_url),
|
ext = self._FORMATS_EXT.get(format_id)
|
||||||
'format_id': format_id,
|
# Fallback: Determine extension from the URL (defaulting to 'mp4' if not found)
|
||||||
'ext': self._FORMATS_EXT[format_id],
|
if not ext:
|
||||||
}
|
ext = determine_ext(format_url, 'mp4').lower()
|
||||||
resolution = resolutions.get(format_id)
|
f = {
|
||||||
if resolution:
|
'url': lowercase_escape(format_url),
|
||||||
f.update({
|
'format_id': format_id,
|
||||||
'width': resolution[0],
|
'ext': ext,
|
||||||
'height': resolution[1],
|
}
|
||||||
})
|
resolution = resolutions.get(format_id)
|
||||||
formats.append(f)
|
if resolution:
|
||||||
|
f.update({
|
||||||
|
'width': resolution[0],
|
||||||
|
'height': resolution[1],
|
||||||
|
})
|
||||||
|
formats.append(f)
|
||||||
|
|
||||||
|
|
||||||
source_url = update_url_query(
|
source_url = update_url_query(
|
||||||
'https://drive.google.com/uc', {
|
'https://drive.google.com/uc', {
|
||||||
|
Loading…
Reference in New Issue
Block a user