This commit is contained in:
Albert Yi
2018-07-06 11:44:07 -07:00
parent 099654b2da
commit a0205be8b5
2 changed files with 13 additions and 0 deletions

View File

@@ -110,6 +110,8 @@ module Sources
"http://fav.me/d#{$1}"
elsif url =~ %r{\Ahttps?://(?:fc|th|pre|orig|img)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i
"http://fav.me/d#{$1}"
elsif url =~ %r{\Ahttps?://www\.deviantart\.com/([^/]+)/art/}
url
elsif url =~ %r{deviantart\.com/art/}
url
else

View File

@@ -7,6 +7,17 @@ module Sources
skip "DeviantArt API keys not set" unless Danbooru.config.deviantart_client_id.present?
end
context "A path-based artist url" do
setup do
@site = Sources::Site.new("https://www.deviantart.com/aeror404/art/Holiday-Elincia-424551484")
@site.get
end
should "work" do
assert_equal(["http://origin-orig.deviantart.net/d533/f/2014/004/8/d/holiday_elincia_by_aeror404-d70rm0s.jpg"], @site.image_urls)
end
end
context "The source for a private DeviantArt image URL" do
setup do
@site = Sources::Site.new("https://pre00.deviantart.net/423b/th/pre/i/2017/281/e/0/mindflayer_girl01_by_nickbeja-dbpxdt8.png")