tests: fix broken tests.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
# https://fantia.jp/profiles/tus_2n9n0fm05fizg
|
# https://fantia.jp/profiles/tus_2n9n0fm05fizg
|
||||||
|
|
||||||
class Source::URL::Fantia < Source::URL
|
class Source::URL::Fantia < Source::URL
|
||||||
attr_reader :full_image_url
|
attr_reader :full_image_url, :fanclub_id, :username, :post_id, :product_id
|
||||||
|
|
||||||
def self.match?(url)
|
def self.match?(url)
|
||||||
url.domain == "fantia.jp"
|
url.domain == "fantia.jp"
|
||||||
|
|||||||
@@ -88,15 +88,15 @@ class Source::URL::Twitter < Source::URL
|
|||||||
end
|
end
|
||||||
|
|
||||||
def image_url?
|
def image_url?
|
||||||
orig_image_url.present?
|
domain == "twimg.com"
|
||||||
end
|
end
|
||||||
|
|
||||||
# https://pbs.twimg.com/media/EBGbJe_U8AA4Ekb.jpg:orig
|
# https://pbs.twimg.com/media/EBGbJe_U8AA4Ekb.jpg:orig
|
||||||
# https://pbs.twimg.com/tweet_video_thumb/ETkN_L3X0AMy1aT.jpg:orig
|
# https://pbs.twimg.com/tweet_video_thumb/ETkN_L3X0AMy1aT.jpg:orig
|
||||||
# https://pbs.twimg.com/ext_tw_video_thumb/1243725361986375680/pu/img/JDA7g7lcw7wK-PIv.jpg:orig
|
# https://pbs.twimg.com/ext_tw_video_thumb/1243725361986375680/pu/img/JDA7g7lcw7wK-PIv.jpg:orig
|
||||||
# https://pbs.twimg.com/amplify_video_thumb/1215590775364259840/img/lolCkEEioFZTb5dl.jpg:orig
|
# https://pbs.twimg.com/amplify_video_thumb/1215590775364259840/img/lolCkEEioFZTb5dl.jpg:orig
|
||||||
def orig_image_url
|
def full_image_url
|
||||||
return nil unless @file_path.present?
|
return to_s unless @file_path.present?
|
||||||
"#{site}/#{@file_path}:orig"
|
"#{site}/#{@file_path}:orig"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def profile_url
|
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/#{api_client.user_id}" if api_client&.user_id.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist_name
|
def artist_name
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ module Sources
|
|||||||
url
|
url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def artists
|
||||||
|
ArtistFinder.find_artists(url)
|
||||||
|
end
|
||||||
|
|
||||||
def normalize_for_source
|
def normalize_for_source
|
||||||
case url
|
case url
|
||||||
when %r{\Ahttp://www\.karabako\.net/images(?:ub)?/karabako_(\d+)(?:_\d+)?\.}i
|
when %r{\Ahttp://www\.karabako\.net/images(?:ub)?/karabako_(\d+)(?:_\d+)?\.}i
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ module Sources::Strategies
|
|||||||
def image_urls
|
def image_urls
|
||||||
# https://pbs.twimg.com/media/EBGbJe_U8AA4Ekb.jpg:orig
|
# https://pbs.twimg.com/media/EBGbJe_U8AA4Ekb.jpg:orig
|
||||||
if parsed_url.image_url?
|
if parsed_url.image_url?
|
||||||
[parsed_url.orig_image_url]
|
[parsed_url.full_image_url]
|
||||||
elsif api_response.present?
|
elsif api_response.present?
|
||||||
api_response.dig(:extended_entities, :media).to_a.map do |media|
|
api_response.dig(:extended_entities, :media).to_a.map do |media|
|
||||||
if media[:type] == "photo"
|
if media[:type] == "photo"
|
||||||
@@ -43,7 +43,7 @@ module Sources::Strategies
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
[url]
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user