weibo: fix https://m.weibo.cn/detail/1234 urls not finding the artist.

Fix https://m.weibo.cn/detail/4506950043618873 type URLs not finding the
artist because the profile_url method returned nil instead of the actual
profile URL.
This commit is contained in:
evazion
2022-03-18 05:51:59 -05:00
parent 03d2098d6d
commit a78b6528dc
2 changed files with 6 additions and 1 deletions

View File

@@ -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?

View File

@@ -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