deviantart: don't apply /intermediary/ hack for gifs
gifs are always stored as original anyways so the /intermediary/ url doesn't actually exist for gifs example: https://www.deviantart.com/heartgear/art/Silent-Night-579982816
This commit is contained in:
@@ -86,7 +86,7 @@ module Sources
|
||||
[api_download[:src]]
|
||||
elsif api_deviation.present?
|
||||
src = api_deviation.dig(:content, :src)
|
||||
if deviation_id && deviation_id.to_i <= 790677560 && src =~ /^https:\/\/images-wixmp-/
|
||||
if deviation_id && deviation_id.to_i <= 790677560 && src =~ /^https:\/\/images-wixmp-/ && src !~ /\.gif\?/
|
||||
src = src.sub(%r!(/f/[a-f0-9-]+/[a-f0-9-]+)!, '/intermediary\1')
|
||||
src = src.sub(%r!/v1/(fit|fill)/.*\z!i, "")
|
||||
end
|
||||
|
||||
@@ -244,6 +244,16 @@ module Sources
|
||||
end
|
||||
end
|
||||
|
||||
context "The source for a non-downloadable animated gif with id<=790677560" do
|
||||
should "return working image url" do
|
||||
@site = Sources::Strategies.find("https://www.deviantart.com/heartgear/art/Silent-Night-579982816")
|
||||
|
||||
# md5: 62caac1863aa264a56d548b4b7607097
|
||||
assert_match(%r!\Ahttps://images-wixmp-ed30a86b8c4ca887773594c2\.wixmp\.com/f/ea95be00-c5aa-4063-bd55-f5a9183912f7/d9lb1ls-7d625444-0003-4123-bf00-274737ca7fdd.gif\?token=!, @site.image_url)
|
||||
assert_downloaded(350_156, @site.image_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "The source for an DeviantArt artwork page" do
|
||||
setup do
|
||||
@site = Sources::Strategies.find("http://noizave.deviantart.com/art/test-post-please-ignore-685436408")
|
||||
|
||||
Reference in New Issue
Block a user