fix: prefer android_vr extractor by default
this is possibly one of the last known extractors unaffected by signature extraction and decryption shenanigans, which cripples load times on lower-end hardware
This commit is contained in:
@@ -132,21 +132,25 @@ web_context_dict = {
|
||||
def extract(url: str, getcomments=False, maxcomments="", manifest_fix=False):
|
||||
# TODO: check user-agent and cookiefile
|
||||
|
||||
ytdl_context = ytdl_opts.copy()
|
||||
|
||||
if ythdd_globals.config['extractor']['user-agent']:
|
||||
yt_dlp.utils.std_headers['User-Agent'] = ythdd_globals.config['extractor']['user-agent']
|
||||
|
||||
if ythdd_globals.config['extractor']['cookies_path']:
|
||||
ytdl_opts['cookiefile'] = ythdd_globals.config['extractor']['cookies_path']
|
||||
ytdl_context['cookiefile'] = ythdd_globals.config['extractor']['cookies_path']
|
||||
|
||||
if len(url) == 11:
|
||||
url = "https://www.youtube.com/watch?v=" + url
|
||||
if getcomments:
|
||||
ytdl_opts['getcomments'] = True
|
||||
ytdl_context['getcomments'] = True
|
||||
if maxcomments:
|
||||
ytdl_opts['extractor_args']['youtube']['max_comments'] = [maxcomments, "all", "all", "all"]
|
||||
ytdl_context['extractor_args']['youtube']['max_comments'] = [maxcomments, "all", "all", "all"]
|
||||
if manifest_fix:
|
||||
# https://github.com/yt-dlp/yt-dlp/issues/11952#issuecomment-2565802294
|
||||
ytdl_opts['extractor_args']['youtube']['player_client'] = ['default', 'web_safari']
|
||||
ytdl_context['extractor_args']['youtube']['player_client'] = ['default', 'web_safari']
|
||||
elif ythdd_globals.config['extractor']['preferred_extractor']:
|
||||
ytdl_context['extractor_args']['youtube']['player_client'] = [ythdd_globals.config['extractor']['preferred_extractor']]
|
||||
with yt_dlp.YoutubeDL(ytdl_opts) as ytdl:
|
||||
result = ytdl.sanitize_info(ytdl.extract_info(url, download=False))
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user