mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
download_http: adding a better U-A. need this for vimeo
This commit is contained in:
parent
5cc26be3eb
commit
9f176d4cc4
@ -15,7 +15,14 @@ else:
|
|||||||
|
|
||||||
def download_http(options, url):
|
def download_http(options, url):
|
||||||
""" Get the stream from HTTP """
|
""" Get the stream from HTTP """
|
||||||
response = urlopen(url)
|
request = Request(url)
|
||||||
|
request.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
|
||||||
|
try:
|
||||||
|
response = urlopen(request)
|
||||||
|
except HTTPError as e:
|
||||||
|
log.error("Something wrong with that url")
|
||||||
|
log.error("Error code: %s" % e.code)
|
||||||
|
sys.exit(5)
|
||||||
try:
|
try:
|
||||||
total_size = response.info()['Content-Length']
|
total_size = response.info()['Content-Length']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
Loading…
Reference in New Issue
Block a user