Yet another feedburner workaround

This one really drove me mad. When the "Referer" is feedburner itself, it just will show html page (with Google Reader Add buttons), instead of the regular feed. Itself adding "?format=xml" at the end of the url also solves it, but users don't know about that...
master
pictuga 2013-11-24 20:43:09 +01:00
parent d3db04332e
commit 1274df4e1d
1 changed files with 3 additions and 1 deletions

View File

@ -208,7 +208,9 @@ class SimpleDownload(urllib2.HTTPCookieProcessor):
urllib2.HTTPCookieProcessor.http_request(self, req)
req.add_unredirected_header('Accept-Encoding', 'gzip')
req.add_unredirected_header('User-Agent', self.useragent)
req.add_unredirected_header('Referer', 'http://%s' % req.get_host())
if req.get_host() != 'feeds.feedburner.com':
req.add_unredirected_header('Referer', 'http://%s' % req.get_host())
if self.cache:
if self.etag:
req.add_unredirected_header('If-None-Match', self.etag)