Bug fix for link_replace empty arg
This commit is contained in:
parent
22a87919da
commit
e75ce42e12
1 changed files with 11 additions and 9 deletions
|
|
@ -475,17 +475,19 @@ class SafariBooks:
|
||||||
return root
|
return root
|
||||||
|
|
||||||
def link_replace(self, link):
|
def link_replace(self, link):
|
||||||
if link[0] == "/" and ("cover" in link or "images" in link or "graphics" in link
|
if link:
|
||||||
or link[-3:] in ["jpg", "peg", "png", "gif"]):
|
|
||||||
if link not in self.images:
|
|
||||||
self.images.append(link)
|
|
||||||
self.display.log("Crawler: found a new image at %s" % link)
|
|
||||||
|
|
||||||
image = link.split("/")[-1]
|
if link[0] == "/" and ("cover" in link or "images" in link or "graphics" in link
|
||||||
return "Images/" + image
|
or link[-3:] in ["jpg", "peg", "png", "gif"]):
|
||||||
|
if link not in self.images:
|
||||||
|
self.images.append(link)
|
||||||
|
self.display.log("Crawler: found a new image at %s" % link)
|
||||||
|
|
||||||
elif link[0] not in ["/", "h"]:
|
image = link.split("/")[-1]
|
||||||
return link.replace(".html", ".xhtml")
|
return "Images/" + image
|
||||||
|
|
||||||
|
elif link[0] not in ["/", "h"]:
|
||||||
|
return link.replace(".html", ".xhtml")
|
||||||
|
|
||||||
return link
|
return link
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue