pixiv: include stacc url in new artist entries (#4028).
This commit is contained in:
@@ -109,12 +109,25 @@ module Sources
|
||||
nil
|
||||
end
|
||||
|
||||
def stacc_url
|
||||
return nil if moniker.blank?
|
||||
"https://www.pixiv.net/stacc/#{moniker}"
|
||||
end
|
||||
|
||||
def profile_urls
|
||||
[profile_url, stacc_url].compact
|
||||
end
|
||||
|
||||
def artist_name
|
||||
metadata.name
|
||||
rescue PixivApiClient::BadIDError
|
||||
nil
|
||||
end
|
||||
|
||||
def other_names
|
||||
[artist_name, moniker].compact.uniq
|
||||
end
|
||||
|
||||
def artist_commentary_title
|
||||
metadata.artist_commentary_title
|
||||
rescue PixivApiClient::BadIDError
|
||||
|
||||
@@ -558,7 +558,8 @@ class ArtistTest < ActiveSupport::TestCase
|
||||
|
||||
assert_equal("niceandcool", artist.name)
|
||||
assert_equal("nice_and_cool", artist.other_names_string)
|
||||
assert_equal("https://www.pixiv.net/member.php?id=906442", artist.url_string)
|
||||
assert_includes(artist.urls.map(&:url), "https://www.pixiv.net/member.php?id=906442")
|
||||
assert_includes(artist.urls.map(&:url), "https://www.pixiv.net/stacc/niceandcool")
|
||||
end
|
||||
|
||||
should "fetch the defaults from the given tag" do
|
||||
@@ -567,8 +568,9 @@ class ArtistTest < ActiveSupport::TestCase
|
||||
artist = Artist.new_with_defaults(name: "test_artist")
|
||||
|
||||
assert_equal("test_artist", artist.name)
|
||||
assert_equal("nice_and_cool", artist.other_names_string)
|
||||
assert_equal("https://www.pixiv.net/member.php?id=906442", artist.url_string)
|
||||
assert_equal("nice_and_cool niceandcool", artist.other_names_string)
|
||||
assert_includes(artist.urls.map(&:url), "https://www.pixiv.net/member.php?id=906442")
|
||||
assert_includes(artist.urls.map(&:url), "https://www.pixiv.net/stacc/niceandcool")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -278,6 +278,17 @@ module Sources
|
||||
assert_equal(["fate/grand_order"], source.translated_tags.map(&:name))
|
||||
end
|
||||
end
|
||||
|
||||
context "fetching the artist data" do
|
||||
should "get the artist names and profile urls" do
|
||||
source = get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=65981746")
|
||||
|
||||
assert_equal("uroobnad", source.tag_name)
|
||||
assert_equal(["uroobnad"], source.other_names)
|
||||
assert_includes(source.profile_urls, "https://www.pixiv.net/member.php?id=696859")
|
||||
assert_includes(source.profile_urls, "https://www.pixiv.net/stacc/uroobnad")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user