[utils] Encode URLs in YoutubeDLCookieProcessor

Closes #263
This commit is contained in:
pukkandan 2021-04-24 19:18:45 +05:30
parent cf9d6cfb0c
commit 915f911e36
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

View File

@ -2921,7 +2921,15 @@ def http_response(self, request, response):
# response.headers[set_cookie_header] = set_cookie_escaped # response.headers[set_cookie_header] = set_cookie_escaped
return compat_urllib_request.HTTPCookieProcessor.http_response(self, request, response) return compat_urllib_request.HTTPCookieProcessor.http_response(self, request, response)
https_request = compat_urllib_request.HTTPCookieProcessor.http_request def http_request(self, request):
# If the URL contains non-ASCII characters, the cookies
# are lost before the request reaches YoutubeDLHandler.
# So we percent encode the url before adding cookies
# See: https://github.com/yt-dlp/yt-dlp/issues/263
request = update_Request(request, url=escape_url(request.get_full_url()))
return compat_urllib_request.HTTPCookieProcessor.http_request(self, request)
https_request = http_request
https_response = http_response https_response = http_response