mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
7e23a26063
commit
3ca574fa32
@ -14,7 +14,7 @@ from contextlib import nested, closing
|
|||||||
|
|
||||||
|
|
||||||
from calibre import (browser, __appname__, iswindows, force_unicode,
|
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.BeautifulSoup import BeautifulSoup, NavigableString, CData, Tag
|
||||||
from calibre.ebooks.metadata.opf2 import OPFCreator
|
from calibre.ebooks.metadata.opf2 import OPFCreator
|
||||||
from calibre import entity_to_unicode
|
from calibre import entity_to_unicode
|
||||||
@ -494,6 +494,9 @@ class BasicNewsRecipe(Recipe):
|
|||||||
return br
|
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 = browser(*args, **kwargs)
|
||||||
br.addheaders += [('Accept', '*/*')]
|
br.addheaders += [('Accept', '*/*')]
|
||||||
if self.handle_gzip:
|
if self.handle_gzip:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user