Twitter: rewrite tests

Also add partial support for profile banner images.
This commit is contained in:
nonamethanks
2022-10-07 17:06:01 +02:00
committed by N. Oname
parent 78fa652646
commit 72528bdcb1
4 changed files with 174 additions and 277 deletions

View File

@@ -58,13 +58,16 @@ class Source::Extractor
end
def intent_url
user_id = api_response.dig(:user, :id_str)
return nil if user_id.blank?
"https://twitter.com/intent/user?user_id=#{user_id}"
end
def profile_urls
[profile_url, intent_url].compact
[profile_url, intent_url].compact.uniq
end
def user_id
parsed_url.user_id || parsed_referer&.user_id || api_response.dig(:user, :id_str)
end
def tag_name
@@ -72,8 +75,6 @@ class Source::Extractor
tag_name_from_url
elsif api_response.present?
api_response.dig(:user, :screen_name)
else
""
end
end