From 4cca843143bab51c7e3bfc5d748b2760a48f182d Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Tue, 5 Mar 2013 23:35:00 +0100 Subject: [PATCH] download_http: adding a better U-A. need this for vimeo. --- svtplay_dl.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/svtplay_dl.py b/svtplay_dl.py index db62cbf..ac980cf 100755 --- a/svtplay_dl.py +++ b/svtplay_dl.py @@ -474,7 +474,14 @@ def download_hls(options, url, baseurl=None): def download_http(options, url): """ 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: + print "ERROR" + print e.reason + sys.exit() try: total_size = response.info()['Content-Length'] except KeyError: