diff --git a/app/logical/sources/strategies/weibo.rb b/app/logical/sources/strategies/weibo.rb index 4f723b4b0..aaec04954 100644 --- a/app/logical/sources/strategies/weibo.rb +++ b/app/logical/sources/strategies/weibo.rb @@ -53,13 +53,17 @@ module Sources end def profile_url - profile_urls.first + "https://www.weibo.com/u/#{artist_id}" if artist_id.present? end def artist_name api_response&.dig("user", "screen_name") end + def artist_id + parsed_url.artist_short_id || parsed_referer&.artist_short_id || api_response&.dig("user", "id") + end + def artist_commentary_desc return if api_response.blank? diff --git a/test/unit/sources/weibo_test.rb b/test/unit/sources/weibo_test.rb index afdd93595..fe32fd7d9 100644 --- a/test/unit/sources/weibo_test.rb +++ b/test/unit/sources/weibo_test.rb @@ -107,6 +107,7 @@ module Sources assert_equal("https://www.weibo.com/5501756072/J2UNKfbqV", @site.page_url) assert_equal("https://www.weibo.com/5501756072/J2UNKfbqV", @site.canonical_url) + assert_equal("https://www.weibo.com/u/5501756072", @site.profile_url) assert_equal(%w[fgo Alter组], @site.tags.map(&:first)) assert_equal("阿尔托莉雅厨", @site.artist_name) end