mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-22 18:17:17 -05:00
[extractor/GoogleDrive] Fix some audio
Only those with source url, but no confirmation page
This commit is contained in:
parent
8e9fe43cd3
commit
4d248e29d2
@ -3,8 +3,8 @@ import re
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_parse_qs
|
from ..compat import compat_parse_qs
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
determine_ext,
|
||||||
get_element_by_class,
|
get_element_by_class,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
lowercase_escape,
|
lowercase_escape,
|
||||||
@ -163,15 +163,13 @@ class GoogleDriveIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
video_info = compat_parse_qs(self._download_webpage(
|
video_info = compat_parse_qs(self._download_webpage(
|
||||||
'https://drive.google.com/get_video_info',
|
'https://drive.google.com/get_video_info',
|
||||||
video_id, query={'docid': video_id}))
|
video_id, 'Downloading video webpage', query={'docid': video_id}))
|
||||||
|
|
||||||
def get_value(key):
|
def get_value(key):
|
||||||
return try_get(video_info, lambda x: x[key][0])
|
return try_get(video_info, lambda x: x[key][0])
|
||||||
|
|
||||||
reason = get_value('reason')
|
reason = get_value('reason')
|
||||||
title = get_value('title')
|
title = get_value('title')
|
||||||
if not title and reason:
|
|
||||||
raise ExtractorError(reason, expected=True)
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
fmt_stream_map = (get_value('fmt_stream_map') or '').split(',')
|
fmt_stream_map = (get_value('fmt_stream_map') or '').split(',')
|
||||||
@ -216,6 +214,11 @@ class GoogleDriveIE(InfoExtractor):
|
|||||||
urlh = request_source_file(source_url, 'source')
|
urlh = request_source_file(source_url, 'source')
|
||||||
if urlh:
|
if urlh:
|
||||||
def add_source_format(urlh):
|
def add_source_format(urlh):
|
||||||
|
nonlocal title
|
||||||
|
if not title:
|
||||||
|
title = self._search_regex(
|
||||||
|
r'\bfilename="([^"]+)"', urlh.headers.get('Content-Disposition'),
|
||||||
|
'title', default=None)
|
||||||
formats.append({
|
formats.append({
|
||||||
# Use redirect URLs as download URLs in order to calculate
|
# Use redirect URLs as download URLs in order to calculate
|
||||||
# correct cookies in _calc_cookies.
|
# correct cookies in _calc_cookies.
|
||||||
@ -251,7 +254,10 @@ class GoogleDriveIE(InfoExtractor):
|
|||||||
or 'unable to extract confirmation code')
|
or 'unable to extract confirmation code')
|
||||||
|
|
||||||
if not formats and reason:
|
if not formats and reason:
|
||||||
self.raise_no_formats(reason, expected=True)
|
if title:
|
||||||
|
self.raise_no_formats(reason, expected=True)
|
||||||
|
else:
|
||||||
|
raise ExtractorError(reason, expected=True)
|
||||||
|
|
||||||
hl = get_value('hl')
|
hl = get_value('hl')
|
||||||
subtitles_id = None
|
subtitles_id = None
|
||||||
|
Loading…
Reference in New Issue
Block a user