From afe9a0259e13106b5111ec9cb537ff691a7835c2 Mon Sep 17 00:00:00 2001 From: Evan Bruhn Date: Mon, 27 Jan 2014 14:05:09 +1100 Subject: [PATCH] Fixes what.cd snatches getting stuck at pre-processing with blackhole downloader Cloudflare requires a user-agent header otherwise will return 403 forbidden. --- headphones/searcher.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/headphones/searcher.py b/headphones/searcher.py index 108feae4..0b64e002 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -1553,6 +1553,9 @@ def preprocesstorrent(resultlist, pre_sorted_list=False): if result[3] == 'Kick Ass Torrent': request.add_header('Referer', 'http://kat.ph/') + if result[3] == 'What.cd': + request.add_header('User-Agent', 'Headphones') + response = urllib2.urlopen(request) if response.info().get('Content-Encoding') == 'gzip': buf = StringIO(response.read())