Fix #5082: NoMethodError when searching an old-style dead fanbox url in artist urls.
This API call:
# profile: https://www.pixiv.net/fanbox/creator/40684196
curl -H "Origin: https://fanbox.cc" "https://api.fanbox.cc/creator.get?userId=40684196"
returns `{ "body": nil }` when the artist is deleted. We didn't expect `body` to be nil.
Also fix it so that `profile_url` returns the `https://www.pixiv.net/fanbox/creator/40684196`
URL if we can't get the `https://<username>.fanbox.cc` URL, usually because the API call failed
because the artist is deleted.
This commit is contained in:
@@ -135,6 +135,15 @@ module Sources
|
||||
end
|
||||
end
|
||||
|
||||
context "A deleted /fanbox/creator/:id profile url" do
|
||||
should "not raise an exception" do
|
||||
source = Source::Extractor.find("https://www.pixiv.net/fanbox/creator/40684196")
|
||||
|
||||
assert_equal("https://www.pixiv.net/fanbox/creator/40684196", source.profile_url)
|
||||
assert_nothing_raised { source.to_h }
|
||||
end
|
||||
end
|
||||
|
||||
context "generating page urls" do
|
||||
should "convert cover images to the profile url" do
|
||||
cover = "https://pixiv.pximg.net/c/400x400_90_a2_g5/fanbox/public/images/creator/1566167/profile/Ix6bnJmTaOAFZhXHLbWyIY1e.jpeg"
|
||||
|
||||
Reference in New Issue
Block a user