mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-05 01:44:33 +01:00
[generic] Fix access to removed function in python 3.4
The `Request.get_origin_req_host` method was deprecated in 3.3, use the `origin_req_host` property if it's not available, see http://docs.python.org/3.3/library/urllib.request.html#urllib.request.Request.get_origin_req_host.
This commit is contained in:
parent
9d840c43b5
commit
ecbe1ad207
@ -185,9 +185,14 @@ class GenericIE(InfoExtractor):
|
|||||||
newurl = newurl.replace(' ', '%20')
|
newurl = newurl.replace(' ', '%20')
|
||||||
newheaders = dict((k,v) for k,v in req.headers.items()
|
newheaders = dict((k,v) for k,v in req.headers.items()
|
||||||
if k.lower() not in ("content-length", "content-type"))
|
if k.lower() not in ("content-length", "content-type"))
|
||||||
|
try:
|
||||||
|
# This function was deprecated in python 3.3 and removed in 3.4
|
||||||
|
origin_req_host = req.get_origin_req_host()
|
||||||
|
except AttributeError:
|
||||||
|
origin_req_host = req.origin_req_host
|
||||||
return HEADRequest(newurl,
|
return HEADRequest(newurl,
|
||||||
headers=newheaders,
|
headers=newheaders,
|
||||||
origin_req_host=req.get_origin_req_host(),
|
origin_req_host=origin_req_host,
|
||||||
unverifiable=True)
|
unverifiable=True)
|
||||||
else:
|
else:
|
||||||
raise compat_urllib_error.HTTPError(req.get_full_url(), code, msg, headers, fp)
|
raise compat_urllib_error.HTTPError(req.get_full_url(), code, msg, headers, fp)
|
||||||
|
Loading…
Reference in New Issue
Block a user