mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
[utils] Refactor handle_youtubedl_headers for future extension
This commit is contained in:
parent
0424ec307b
commit
992fc9d6e1
@ -664,12 +664,13 @@ def _hc_connect(self, *args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
def handle_youtubedl_headers(headers):
|
def handle_youtubedl_headers(headers):
|
||||||
if 'Youtubedl-no-compression' in headers:
|
filtered_headers = headers
|
||||||
filtered_headers = dict((k, v) for k, v in headers.items() if k.lower() != 'accept-encoding')
|
|
||||||
del filtered_headers['Youtubedl-no-compression']
|
|
||||||
return filtered_headers
|
|
||||||
|
|
||||||
return headers
|
if 'Youtubedl-no-compression' in filtered_headers:
|
||||||
|
filtered_headers = dict((k, v) for k, v in filtered_headers.items() if k.lower() != 'accept-encoding')
|
||||||
|
del filtered_headers['Youtubedl-no-compression']
|
||||||
|
|
||||||
|
return filtered_headers
|
||||||
|
|
||||||
|
|
||||||
class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
|
class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
|
||||||
|
Loading…
Reference in New Issue
Block a user