Prevent pixiv downloader from returning wrong image
This commit is contained in:
@@ -50,9 +50,12 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_image_url_from_page(page)
|
def get_image_url_from_page(page)
|
||||||
element = page.search("div.works_display a img").first
|
elements = page.search("div.works_display a img").find_all do |node|
|
||||||
if element
|
node["src"] !~ /source\.pixiv\.net/
|
||||||
element.attr("src").sub(/_[ms]\./, ".")
|
end
|
||||||
|
|
||||||
|
if elements.any?
|
||||||
|
elements.first.attr("src").sub(/_[ms]\./, ".")
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user