gelbooru: fix exception in md5-based post urls.
Fix exception when trying to get the image URL for sources like https://gelbooru.com/index.php?page=post&s=list&md5=04f2767c64593c3030ce74ecc2528704.
This commit is contained in:
@@ -59,7 +59,7 @@ module Source
|
||||
end
|
||||
|
||||
memoize def post_id_from_md5
|
||||
return nil unless parsed_url.image_url? && parsed_url.page_url.present?
|
||||
return nil unless parsed_url.page_url.present?
|
||||
|
||||
response = http.cache(1.minute).head(parsed_url.page_url)
|
||||
return nil unless response.status == 200
|
||||
|
||||
@@ -54,5 +54,18 @@ module Sources
|
||||
download_size: 480_621,
|
||||
)
|
||||
end
|
||||
|
||||
context "A Gelbooru md5 page url" do
|
||||
strategy_should_work(
|
||||
"https://gelbooru.com/index.php?page=post&s=list&md5=04f2767c64593c3030ce74ecc2528704",
|
||||
image_urls: ["https://img3.gelbooru.com/images/04/f2/04f2767c64593c3030ce74ecc2528704.jpg"],
|
||||
artist_name: "灰色灰烬bot",
|
||||
profile_url: "https://www.pixiv.net/users/3330425",
|
||||
tags: %w[1girl back_bow bangs black_pantyhose blue_bow blue_hair blue_ribbon boots bow cape chibi chinese_commentary closed_eyes full_body hair_between_eyes hair_ribbon hat hatsune_miku indai_(3330425) on_ground pantyhose pom_pom_(clothes) rabbit rabbit_yukine rating:general ribbon simple_background sitting solo twintails vocaloid white_background white_cape white_headwear witch_hat yuki_miku yuki_miku_(2014) 初音ミク 雪ミク],
|
||||
artist_commentary_title: "2010~2021雪ミク",
|
||||
artist_commentary_desc: "动作参考@速写班长",
|
||||
download_size: 480_621,
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user