sources: fix dummy names being suggested as other names.

Fix placeholder names like weibo_1234, bilibili_1234, nijie1234, and nicoseiga1234 being suggested
as Other Names when creating new artist entries. These are meant to be placeholders for the tag
name, not used as other names.
This commit is contained in:
evazion
2022-11-21 14:37:50 -06:00
parent 5559219f0a
commit 2d83500885
10 changed files with 44 additions and 8 deletions

View File

@@ -90,6 +90,10 @@ module Source
"bilibili_#{artist_id}" "bilibili_#{artist_id}"
end end
def other_names
[artist_name].compact
end
def artist_id def artist_id
artist_id_from_data || parsed_url.artist_id || parsed_referer&.artist_id artist_id_from_data || parsed_url.artist_id || parsed_referer&.artist_id
end end

View File

@@ -40,7 +40,7 @@ module Source
end end
def profile_url def profile_url
"https://seiga.nicovideo.jp/user/illust/#{api_client.user_id}" if api_client&.user_id.present? "https://seiga.nicovideo.jp/user/illust/#{artist_id}" if artist_id.present?
end end
def artist_name def artist_name
@@ -67,8 +67,11 @@ module Source
end end
def tag_name def tag_name
return if api_client&.user_id.blank? "nicoseiga_#{artist_id}" if artist_id.present?
"nicoseiga#{api_client.user_id}" end
def other_names
[artist_name].compact
end end
def tags def tags
@@ -95,6 +98,10 @@ module Source
parsed_url.manga_id || parsed_referer&.manga_id parsed_url.manga_id || parsed_referer&.manga_id
end end
def artist_id
api_client&.user_id
end
def http def http
if parsed_url.oekaki_id.present? if parsed_url.oekaki_id.present?
super.with_legacy_ssl super.with_legacy_ssl

View File

@@ -78,7 +78,11 @@ module Source
end end
def tag_name def tag_name
"nijie" + artist_id.to_s "nijie_#{artist_id}" if artist_id.present?
end
def other_names
[artist_name].compact
end end
def self.to_dtext(text) def self.to_dtext(text)

View File

@@ -56,7 +56,11 @@ module Source
end end
def tag_name def tag_name
nil "tinami_#{user_id}" if user_id.present?
end
def other_names
[artist_name].compact
end end
def artist_name def artist_name

View File

@@ -59,6 +59,10 @@ module Source
api_response&.dig("user", "screen_name") api_response&.dig("user", "screen_name")
end end
def other_names
[artist_name].compact
end
def artist_id def artist_id
parsed_url.artist_short_id || parsed_referer&.artist_short_id || api_response&.dig("user", "id") parsed_url.artist_short_id || parsed_referer&.artist_short_id || api_response&.dig("user", "id")
end end

View File

@@ -18,6 +18,7 @@ module Sources
], ],
page_url: "https://t.bilibili.com/686082748803186697", page_url: "https://t.bilibili.com/686082748803186697",
artist_name: "哈米伦的弄笛者", artist_name: "哈米伦的弄笛者",
other_names: ["哈米伦的弄笛者"],
tag_name: "bilibili_11742550", tag_name: "bilibili_11742550",
profile_url: "https://space.bilibili.com/11742550", profile_url: "https://space.bilibili.com/11742550",
tags: [], tags: [],
@@ -39,6 +40,7 @@ module Sources
], ],
page_url: "https://t.bilibili.com/722702993036673113", page_url: "https://t.bilibili.com/722702993036673113",
artist_name: "星尘Official", artist_name: "星尘Official",
other_names: ["星尘Official"],
tag_name: "bilibili_15817819", tag_name: "bilibili_15817819",
profile_url: "https://space.bilibili.com/15817819", profile_url: "https://space.bilibili.com/15817819",
tags: [], tags: [],
@@ -76,6 +78,7 @@ module Sources
], ],
artist_commentary_title: nil, artist_commentary_title: nil,
artist_name: "明日方舟", artist_name: "明日方舟",
other_names: ["明日方舟"],
profile_url: "https://space.bilibili.com/161775300", profile_url: "https://space.bilibili.com/161775300",
page_url: "https://h.bilibili.com/83341894", page_url: "https://h.bilibili.com/83341894",
tag_name: "bilibili_161775300", tag_name: "bilibili_161775300",
@@ -100,6 +103,7 @@ module Sources
], ],
page_url: "https://www.bilibili.com/read/cv7360489", page_url: "https://www.bilibili.com/read/cv7360489",
artist_name: "时光印记2016", artist_name: "时光印记2016",
other_names: ["时光印记2016"],
tag_name: "bilibili_285452636", tag_name: "bilibili_285452636",
profile_url: "https://space.bilibili.com/285452636", profile_url: "https://space.bilibili.com/285452636",
artist_commentary_title: "斗罗大陆 4觉醒后的古月娜第一期", artist_commentary_title: "斗罗大陆 4觉醒后的古月娜第一期",

View File

@@ -22,7 +22,8 @@ module Sources
page_url: "https://seiga.nicovideo.jp/seiga/im4937663", page_url: "https://seiga.nicovideo.jp/seiga/im4937663",
tags: tags, tags: tags,
artist_name: "osamari", artist_name: "osamari",
tag_name: "nicoseiga7017777", other_names: ["osamari"],
tag_name: "nicoseiga_7017777",
profile_url: "https://seiga.nicovideo.jp/user/illust/7017777", profile_url: "https://seiga.nicovideo.jp/user/illust/7017777",
artist_commentary_title: "コジコジ", artist_commentary_title: "コジコジ",
artist_commentary_desc: "コジコジのドット絵\nこんなかわいらしい容姿で毒を吐くコジコジが堪らん(切実)" artist_commentary_desc: "コジコジのドット絵\nこんなかわいらしい容姿で毒を吐くコジコジが堪らん(切実)"
@@ -45,7 +46,8 @@ module Sources
page_url: "https://seiga.nicovideo.jp/seiga/im4937663", page_url: "https://seiga.nicovideo.jp/seiga/im4937663",
tags: tags, tags: tags,
artist_name: "osamari", artist_name: "osamari",
tag_name: "nicoseiga7017777", other_names: ["osamari"],
tag_name: "nicoseiga_7017777",
profile_url: "https://seiga.nicovideo.jp/user/illust/7017777", profile_url: "https://seiga.nicovideo.jp/user/illust/7017777",
artist_commentary_title: "コジコジ", artist_commentary_title: "コジコジ",
artist_commentary_desc: "コジコジのドット絵\nこんなかわいらしい容姿で毒を吐くコジコジが堪らん(切実)" artist_commentary_desc: "コジコジのドット絵\nこんなかわいらしい容姿で毒を吐くコジコジが堪らん(切実)"
@@ -186,7 +188,8 @@ module Sources
page_url: "https://seiga.nicovideo.jp/watch/mg302561", page_url: "https://seiga.nicovideo.jp/watch/mg302561",
tags: [["ロリ", "https://seiga.nicovideo.jp/manga/tag/%E3%83%AD%E3%83%AA"]], tags: [["ロリ", "https://seiga.nicovideo.jp/manga/tag/%E3%83%AD%E3%83%AA"]],
artist_name: "とろてい", artist_name: "とろてい",
tag_name: "nicoseiga1848060" other_names: ["とろてい"],
tag_name: "nicoseiga_1848060"
) )
end end

View File

@@ -44,6 +44,7 @@ module Sources
image_urls: ["https://pic.nijie.net/07/nijie/17/95/728995/illust/0_0_403fdd541191110c_c25585.jpg"], image_urls: ["https://pic.nijie.net/07/nijie/17/95/728995/illust/0_0_403fdd541191110c_c25585.jpg"],
download_size: 132_555, download_size: 132_555,
artist_name: "", artist_name: "",
other_names: [""],
profile_url: "https://nijie.info/members.php?id=728995", profile_url: "https://nijie.info/members.php?id=728995",
artist_commentary_title: "ジャージの下は", artist_commentary_title: "ジャージの下は",
dtext_artist_commentary_desc: "「リトルウィッチアカデミア」から無自覚サキュバスぶりを発揮するアーシュラ先生です", dtext_artist_commentary_desc: "「リトルウィッチアカデミア」から無自覚サキュバスぶりを発揮するアーシュラ先生です",

View File

@@ -8,6 +8,7 @@ module Sources
source = Source::Extractor.find("http://www.tinami.com/view/1087268") source = Source::Extractor.find("http://www.tinami.com/view/1087268")
assert_equal("みぐめ", source.artist_name) assert_equal("みぐめ", source.artist_name)
assert_equal(["みぐめ"], source.other_names)
assert_equal("https://www.tinami.com/view/1087268", source.page_url) assert_equal("https://www.tinami.com/view/1087268", source.page_url)
assert_equal(["https://img.tinami.com/illust2/img/49/6234fe552348b.jpg"], source.image_urls) assert_equal(["https://img.tinami.com/illust2/img/49/6234fe552348b.jpg"], source.image_urls)
assert_equal("https://www.tinami.com/creator/profile/66493", source.profile_url) assert_equal("https://www.tinami.com/creator/profile/66493", source.profile_url)
@@ -22,6 +23,7 @@ module Sources
source = Source::Extractor.find("http://www.tinami.com/view/1087271") source = Source::Extractor.find("http://www.tinami.com/view/1087271")
assert_equal("Shimaken", source.artist_name) assert_equal("Shimaken", source.artist_name)
assert_equal(["Shimaken"], source.other_names)
assert_equal("https://www.tinami.com/view/1087271", source.page_url) assert_equal("https://www.tinami.com/view/1087271", source.page_url)
assert_equal(%w[ assert_equal(%w[
https://img.tinami.com/illust2/img/458/62351d05dc2d1.jpg https://img.tinami.com/illust2/img/458/62351d05dc2d1.jpg
@@ -40,6 +42,7 @@ module Sources
source = Source::Extractor.find("http://www.tinami.com/view/1087270") source = Source::Extractor.find("http://www.tinami.com/view/1087270")
assert_equal("セラ箱", source.artist_name) assert_equal("セラ箱", source.artist_name)
assert_equal(["セラ箱"], source.other_names)
assert_equal("https://www.tinami.com/view/1087270", source.page_url) assert_equal("https://www.tinami.com/view/1087270", source.page_url)
assert_equal(%w[ assert_equal(%w[
https://img.tinami.com/illust2/img/399/623503bb2c686.jpg https://img.tinami.com/illust2/img/399/623503bb2c686.jpg
@@ -84,6 +87,7 @@ module Sources
source = Source::Extractor.find("https://img.tinami.com/illust2/img/647/6234fe5588e97.jpg", "http://www.tinami.com/view/1087268") source = Source::Extractor.find("https://img.tinami.com/illust2/img/647/6234fe5588e97.jpg", "http://www.tinami.com/view/1087268")
assert_equal("みぐめ", source.artist_name) assert_equal("みぐめ", source.artist_name)
assert_equal(["みぐめ"], source.other_names)
assert_equal("https://www.tinami.com/view/1087268", source.page_url) assert_equal("https://www.tinami.com/view/1087268", source.page_url)
assert_equal(["https://img.tinami.com/illust2/img/647/6234fe5588e97.jpg"], source.image_urls) assert_equal(["https://img.tinami.com/illust2/img/647/6234fe5588e97.jpg"], source.image_urls)
assert_equal("https://www.tinami.com/creator/profile/66493", source.profile_url) assert_equal("https://www.tinami.com/creator/profile/66493", source.profile_url)

View File

@@ -118,6 +118,7 @@ module Sources
image_urls: ["https://wx3.sinaimg.cn/large/007bspzxly1h23na4y0hhj32982pinpd.jpg"], image_urls: ["https://wx3.sinaimg.cn/large/007bspzxly1h23na4y0hhj32982pinpd.jpg"],
download_size: 1_781_330, download_size: 1_781_330,
artist_name: "号布谷鸟", artist_name: "号布谷鸟",
other_names: ["号布谷鸟"],
artist_commentary_desc: "<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E5%BF%AB%E9%80%92%E7%BB%84%23&extparam=%23%E5%BF%AB%E9%80%92%E7%BB%84%23&luicode=20000061&lfid=4767694689143828\" data-hide=\"\"><span class=\"surl-text\">#快递组#</span></a> 摸了 ", artist_commentary_desc: "<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E5%BF%AB%E9%80%92%E7%BB%84%23&extparam=%23%E5%BF%AB%E9%80%92%E7%BB%84%23&luicode=20000061&lfid=4767694689143828\" data-hide=\"\"><span class=\"surl-text\">#快递组#</span></a> 摸了 ",
profile_url: "https://www.weibo.com/u/6582241007", profile_url: "https://www.weibo.com/u/6582241007",
profile_urls: ["https://www.weibo.com/u/6582241007"], profile_urls: ["https://www.weibo.com/u/6582241007"],