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()) diff --git a/lib/pygazelle/api.py b/lib/pygazelle/api.py index 4e93b47d..a778b93a 100644 --- a/lib/pygazelle/api.py +++ b/lib/pygazelle/api.py @@ -98,7 +98,7 @@ class GazelleAPI(object): loginpage = 'https://what.cd/login.php' data = {'username': self.username, 'password': self.password} - r = self.session.post(loginpage, data=data, timeout=self.default_timeout) + r = self.session.post(loginpage, data=data, timeout=self.default_timeout, headers=self.default_headers) self.past_request_timestamps.append(time.time()) if r.status_code != 200: raise LoginException("Login returned status code %s" % r.status_code)