This commit is contained in:
r888888888
2017-10-09 16:32:05 -07:00
parent 4b2dcca8a2
commit d4008a5ddc
2 changed files with 16 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ module Sources
@artist_commentary_title = get_artist_commentary_title_from_page(page)
@artist_commentary_desc = get_artist_commentary_desc_from_page(page)
end
rescue Mechanize::ResponseCodeError
# try the normal url
if url =~ /\.(jpg|jpeg|png|gif)/
@image_url = url
end
end
def self.to_dtext(text)

View File

@@ -2,6 +2,17 @@ require 'test_helper'
module Sources
class DeviantArtTest < ActiveSupport::TestCase
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")
@site.get
end
should "work" do
assert_equal(["https://pre00.deviantart.net/423b/th/pre/i/2017/281/e/0/mindflayer_girl01_by_nickbeja-dbpxdt8.png"], @site.image_urls)
end
end
context "The source for an DeviantArt artwork page" do
setup do
@site = Sources::Site.new("http://noizave.deviantart.com/art/test-post-please-ignore-685436408")