gelbooru: fix exception when fetching data for deleted post.

Fix exceptions when fetching deleted or nonexistent posts from Gelbooru. The Gelbooru API doesn't
return any data for deleted posts.
This commit is contained in:
evazion
2022-11-08 15:17:51 -06:00
parent 00db63e885
commit 03a4f1a46e
2 changed files with 32 additions and 4 deletions

View File

@@ -68,6 +68,30 @@ module Sources
)
end
context "A deleted Gelbooru post" do
strategy_should_work(
"https://gelbooru.com/index.php?page=post&s=list&md5=9d06e876937d46eeda7a5e0ca52f63a8",
image_urls: [],
artist_name: nil,
profile_url: nil,
tags: %w[],
artist_commentary_title: nil,
artist_commentary_desc: nil,
)
end
context "A nonexistent Gelbooru post" do
strategy_should_work(
"https://gelbooru.com/index.php?page=post&s=list&md5=ffffffffffffffffffffffffffffffff",
image_urls: [],
artist_name: nil,
profile_url: nil,
tags: %w[],
artist_commentary_title: nil,
artist_commentary_desc: nil,
)
end
should "normalize gelbooru links" do
source1 = "https://gelbooru.com//images/ee/5c/ee5c9a69db9602c95debdb9b98fb3e3e.jpeg"
source2 = "http://simg.gelbooru.com//images/2003/edd1d2b3881cf70c3acf540780507531.png"