[ie/abematv] Fix proxy handling (#8046)

Fixes https://github.com/yt-dlp/yt-dlp/issues/8036

Authored by: SevenLives
This commit is contained in:
SevenLives 2023-09-16 17:37:04 +08:00 committed by GitHub
parent 7b71643cc9
commit 497bbbbd73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,7 @@ import urllib.parse
import urllib.request import urllib.request
import urllib.response import urllib.response
import uuid import uuid
from ..utils.networking import clean_proxies
from .common import InfoExtractor from .common import InfoExtractor
from ..aes import aes_ecb_decrypt from ..aes import aes_ecb_decrypt
from ..utils import ( from ..utils import (
@ -35,7 +35,10 @@ def add_opener(ydl, handler): # FIXME: Create proper API in .networking
rh = ydl._request_director.handlers['Urllib'] rh = ydl._request_director.handlers['Urllib']
if 'abematv-license' in rh._SUPPORTED_URL_SCHEMES: if 'abematv-license' in rh._SUPPORTED_URL_SCHEMES:
return return
opener = rh._get_instance(cookiejar=ydl.cookiejar, proxies=ydl.proxies) headers = ydl.params['http_headers'].copy()
proxies = ydl.proxies.copy()
clean_proxies(proxies, headers)
opener = rh._get_instance(cookiejar=ydl.cookiejar, proxies=proxies)
assert isinstance(opener, urllib.request.OpenerDirector) assert isinstance(opener, urllib.request.OpenerDirector)
opener.add_handler(handler) opener.add_handler(handler)
rh._SUPPORTED_URL_SCHEMES = (*rh._SUPPORTED_URL_SCHEMES, 'abematv-license') rh._SUPPORTED_URL_SCHEMES = (*rh._SUPPORTED_URL_SCHEMES, 'abematv-license')