From f7794de0b7791f0008d239675e4aaf90fabe2e9a Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 26 Aug 2022 01:18:54 -0500 Subject: [PATCH] weibo: fix bad artist name suggestions in new artist form. Fix the new artist form suggesting invalid Chinese tag names for Weibo artists. Suggest `weibo_123456` instead as a placeholder. --- app/logical/source/extractor/weibo.rb | 8 ++++---- test/unit/sources/weibo_test.rb | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/logical/source/extractor/weibo.rb b/app/logical/source/extractor/weibo.rb index 0569a6e7f..530aa9e97 100644 --- a/app/logical/source/extractor/weibo.rb +++ b/app/logical/source/extractor/weibo.rb @@ -47,14 +47,14 @@ module Source end end - def profile_urls - [parsed_url.profile_url, parsed_referer&.profile_url].compact.uniq - end - def profile_url "https://www.weibo.com/u/#{artist_id}" if artist_id.present? end + def tag_name + "weibo_#{artist_id}" if artist_id.present? + end + def artist_name api_response&.dig("user", "screen_name") end diff --git a/test/unit/sources/weibo_test.rb b/test/unit/sources/weibo_test.rb index 7f108a6f1..2f1c3893a 100644 --- a/test/unit/sources/weibo_test.rb +++ b/test/unit/sources/weibo_test.rb @@ -120,6 +120,7 @@ module Sources artist_name: "号布谷鸟", artist_commentary_desc: "#快递组# 摸了 ", profile_url: "https://www.weibo.com/u/6582241007", + profile_urls: ["https://www.weibo.com/u/6582241007"], tags: ["快递组"] ) end