deviantart: fix non-downloadable flash files

This commit is contained in:
lllusion3469
2020-05-11 00:55:06 +02:00
parent 46e9f2dede
commit 0d5e31868f
2 changed files with 12 additions and 0 deletions

View File

@@ -88,6 +88,8 @@ module Sources
url
elsif api_deviation[:is_downloadable]
api_download[:src]
elsif api_deviation[:flash].present?
api_deviation.dig(:flash, :src)
else
src = api_deviation.dig(:content, :src)
if deviation_id && deviation_id.to_i <= 790677560 && src =~ /^https:\/\/images-wixmp-/ && src !~ /\.gif\?/

View File

@@ -254,6 +254,16 @@ module Sources
end
end
context "The source for a non-downloadable flash file" do
should "return working image url" do
@site = Sources::Strategies.find("https://www.deviantart.com/heartgear/art/SL-40v3-522007633")
# md5: 6adf1a3d532f898f44cf9948cbc7db7d
assert_match(%r!\Ahttps://api-da\.wixmp\.com/_api/download/file\?downloadToken=!, @site.image_url)
assert_downloaded(3_496_110, @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")