diff --git a/app/logical/source/extractor/bilibili.rb b/app/logical/source/extractor/bilibili.rb index 9af8710ff..d465990fe 100644 --- a/app/logical/source/extractor/bilibili.rb +++ b/app/logical/source/extractor/bilibili.rb @@ -90,6 +90,10 @@ module Source "bilibili_#{artist_id}" end + def other_names + [artist_name].compact + end + def artist_id artist_id_from_data || parsed_url.artist_id || parsed_referer&.artist_id end diff --git a/app/logical/source/extractor/nico_seiga.rb b/app/logical/source/extractor/nico_seiga.rb index 2303ba146..cc9abe6dd 100644 --- a/app/logical/source/extractor/nico_seiga.rb +++ b/app/logical/source/extractor/nico_seiga.rb @@ -40,7 +40,7 @@ module Source end 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 def artist_name @@ -67,8 +67,11 @@ module Source end def tag_name - return if api_client&.user_id.blank? - "nicoseiga#{api_client.user_id}" + "nicoseiga_#{artist_id}" if artist_id.present? + end + + def other_names + [artist_name].compact end def tags @@ -95,6 +98,10 @@ module Source parsed_url.manga_id || parsed_referer&.manga_id end + def artist_id + api_client&.user_id + end + def http if parsed_url.oekaki_id.present? super.with_legacy_ssl diff --git a/app/logical/source/extractor/nijie.rb b/app/logical/source/extractor/nijie.rb index 3e41f66c4..1ac3bb25a 100644 --- a/app/logical/source/extractor/nijie.rb +++ b/app/logical/source/extractor/nijie.rb @@ -78,7 +78,11 @@ module Source end def tag_name - "nijie" + artist_id.to_s + "nijie_#{artist_id}" if artist_id.present? + end + + def other_names + [artist_name].compact end def self.to_dtext(text) diff --git a/app/logical/source/extractor/tinami.rb b/app/logical/source/extractor/tinami.rb index 6632e270c..007c55382 100644 --- a/app/logical/source/extractor/tinami.rb +++ b/app/logical/source/extractor/tinami.rb @@ -56,7 +56,11 @@ module Source end def tag_name - nil + "tinami_#{user_id}" if user_id.present? + end + + def other_names + [artist_name].compact end def artist_name diff --git a/app/logical/source/extractor/weibo.rb b/app/logical/source/extractor/weibo.rb index 530aa9e97..2dfa7b8f4 100644 --- a/app/logical/source/extractor/weibo.rb +++ b/app/logical/source/extractor/weibo.rb @@ -59,6 +59,10 @@ module Source api_response&.dig("user", "screen_name") end + def other_names + [artist_name].compact + end + def artist_id parsed_url.artist_short_id || parsed_referer&.artist_short_id || api_response&.dig("user", "id") end diff --git a/test/unit/sources/bilibili_test.rb b/test/unit/sources/bilibili_test.rb index 8b779d79d..7576f0745 100644 --- a/test/unit/sources/bilibili_test.rb +++ b/test/unit/sources/bilibili_test.rb @@ -18,6 +18,7 @@ module Sources ], page_url: "https://t.bilibili.com/686082748803186697", artist_name: "哈米伦的弄笛者", + other_names: ["哈米伦的弄笛者"], tag_name: "bilibili_11742550", profile_url: "https://space.bilibili.com/11742550", tags: [], @@ -39,6 +40,7 @@ module Sources ], page_url: "https://t.bilibili.com/722702993036673113", artist_name: "星尘Official", + other_names: ["星尘Official"], tag_name: "bilibili_15817819", profile_url: "https://space.bilibili.com/15817819", tags: [], @@ -76,6 +78,7 @@ module Sources ], artist_commentary_title: nil, artist_name: "明日方舟", + other_names: ["明日方舟"], profile_url: "https://space.bilibili.com/161775300", page_url: "https://h.bilibili.com/83341894", tag_name: "bilibili_161775300", @@ -100,6 +103,7 @@ module Sources ], page_url: "https://www.bilibili.com/read/cv7360489", artist_name: "时光印记2016", + other_names: ["时光印记2016"], tag_name: "bilibili_285452636", profile_url: "https://space.bilibili.com/285452636", artist_commentary_title: "斗罗大陆 4,觉醒后的古月娜(第一期)", diff --git a/test/unit/sources/nico_seiga_test.rb b/test/unit/sources/nico_seiga_test.rb index 902c89cae..8e76951b5 100644 --- a/test/unit/sources/nico_seiga_test.rb +++ b/test/unit/sources/nico_seiga_test.rb @@ -22,7 +22,8 @@ module Sources page_url: "https://seiga.nicovideo.jp/seiga/im4937663", tags: tags, artist_name: "osamari", - tag_name: "nicoseiga7017777", + other_names: ["osamari"], + tag_name: "nicoseiga_7017777", profile_url: "https://seiga.nicovideo.jp/user/illust/7017777", artist_commentary_title: "コジコジ", artist_commentary_desc: "コジコジのドット絵\nこんなかわいらしい容姿で毒を吐くコジコジが堪らん(切実)" @@ -45,7 +46,8 @@ module Sources page_url: "https://seiga.nicovideo.jp/seiga/im4937663", tags: tags, artist_name: "osamari", - tag_name: "nicoseiga7017777", + other_names: ["osamari"], + tag_name: "nicoseiga_7017777", profile_url: "https://seiga.nicovideo.jp/user/illust/7017777", artist_commentary_title: "コジコジ", artist_commentary_desc: "コジコジのドット絵\nこんなかわいらしい容姿で毒を吐くコジコジが堪らん(切実)" @@ -186,7 +188,8 @@ module Sources page_url: "https://seiga.nicovideo.jp/watch/mg302561", tags: [["ロリ", "https://seiga.nicovideo.jp/manga/tag/%E3%83%AD%E3%83%AA"]], artist_name: "とろてい", - tag_name: "nicoseiga1848060" + other_names: ["とろてい"], + tag_name: "nicoseiga_1848060" ) end diff --git a/test/unit/sources/nijie_test.rb b/test/unit/sources/nijie_test.rb index f09eb4835..8a8ce2a0e 100644 --- a/test/unit/sources/nijie_test.rb +++ b/test/unit/sources/nijie_test.rb @@ -44,6 +44,7 @@ module Sources image_urls: ["https://pic.nijie.net/07/nijie/17/95/728995/illust/0_0_403fdd541191110c_c25585.jpg"], download_size: 132_555, artist_name: "莚", + other_names: ["莚"], profile_url: "https://nijie.info/members.php?id=728995", artist_commentary_title: "ジャージの下は", dtext_artist_commentary_desc: "「リトルウィッチアカデミア」から無自覚サキュバスぶりを発揮するアーシュラ先生です", diff --git a/test/unit/sources/tinami_test.rb b/test/unit/sources/tinami_test.rb index 79056f709..6b32e5d1c 100644 --- a/test/unit/sources/tinami_test.rb +++ b/test/unit/sources/tinami_test.rb @@ -8,6 +8,7 @@ module Sources source = Source::Extractor.find("http://www.tinami.com/view/1087268") assert_equal("みぐめ", source.artist_name) + assert_equal(["みぐめ"], source.other_names) 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://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") 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(%w[ 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") assert_equal("セラ箱", source.artist_name) + assert_equal(["セラ箱"], source.other_names) assert_equal("https://www.tinami.com/view/1087270", source.page_url) assert_equal(%w[ 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") assert_equal("みぐめ", source.artist_name) + assert_equal(["みぐめ"], source.other_names) 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://www.tinami.com/creator/profile/66493", source.profile_url) diff --git a/test/unit/sources/weibo_test.rb b/test/unit/sources/weibo_test.rb index 2f1c3893a..17ef58f85 100644 --- a/test/unit/sources/weibo_test.rb +++ b/test/unit/sources/weibo_test.rb @@ -118,6 +118,7 @@ module Sources image_urls: ["https://wx3.sinaimg.cn/large/007bspzxly1h23na4y0hhj32982pinpd.jpg"], download_size: 1_781_330, artist_name: "号布谷鸟", + other_names: ["号布谷鸟"], artist_commentary_desc: "#快递组# 摸了 ", profile_url: "https://www.weibo.com/u/6582241007", profile_urls: ["https://www.weibo.com/u/6582241007"],