mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Allow using image_url_processor to skip img downloads
This commit is contained in:
parent
c60d61a777
commit
b3828dcec7
@ -491,7 +491,8 @@ class BasicNewsRecipe(Recipe):
|
||||
def image_url_processor(cls, baseurl, url):
|
||||
'''
|
||||
Perform some processing on image urls (perhaps removing size restrictions for
|
||||
dynamically generated images, etc.) and return the precessed URL.
|
||||
dynamically generated images, etc.) and return the precessed URL. Return None
|
||||
or an empty string to skip fetching the image.
|
||||
'''
|
||||
return url
|
||||
|
||||
|
@ -407,6 +407,8 @@ class RecursiveFetcher:
|
||||
else:
|
||||
if callable(self.image_url_processor):
|
||||
iurl = self.image_url_processor(baseurl, iurl)
|
||||
if not iurl:
|
||||
continue
|
||||
if not urlsplit(iurl).scheme:
|
||||
iurl = urljoin(baseurl, iurl, False)
|
||||
found_in_cache = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user