News download: Do not use IE user agent as more and more websites are serving JPEG XR images to IE

This commit is contained in:
Kovid Goyal 2017-03-15 17:00:53 +05:30
parent 7e23a26063
commit 3ca574fa32

View File

@ -14,7 +14,7 @@ from contextlib import nested, closing
from calibre import (browser, __appname__, iswindows, force_unicode,
strftime, preferred_encoding, as_unicode)
strftime, preferred_encoding, as_unicode, random_user_agent)
from calibre.ebooks.BeautifulSoup import BeautifulSoup, NavigableString, CData, Tag
from calibre.ebooks.metadata.opf2 import OPFCreator
from calibre import entity_to_unicode
@ -494,6 +494,9 @@ class BasicNewsRecipe(Recipe):
return br
'''
if 'user_agent' not in kwargs:
# More and more news sites are serving JPEG XR images to IE
kwargs['user_agent'] = random_user_agent(allow_ie=False)
br = browser(*args, **kwargs)
br.addheaders += [('Accept', '*/*')]
if self.handle_gzip: