deviantart: fix artist finder for profile urls missing the 'www'.
Fix the artist finder to work when the profile url in the artist entry is missing the 'www'. Example: https://deviantart.com/noizave https://www.deviantart.com/noizave
This commit is contained in:
@@ -24,6 +24,12 @@
|
||||
# * https://noizave.deviantart.com/art/test-post-please-ignore-685436408
|
||||
# * https://www.deviantart.com/deviation/685436408
|
||||
# * https://fav.me/dbc3a48
|
||||
#
|
||||
# Profile URLs:
|
||||
#
|
||||
# * https://noizave.deviantart.com
|
||||
# * https://www.deviantart.com/noizave
|
||||
# * https://deviantart.com/noizave
|
||||
|
||||
module Sources
|
||||
module Strategies
|
||||
@@ -40,7 +46,7 @@ module Sources
|
||||
PATH_ART = %r{\Ahttps?://www\.deviantart\.com/#{ARTIST}/art/#{TITLE}-#{DEVIATION_ID}\z}i
|
||||
SUBDOMAIN_ART = %r{\Ahttps?://#{ARTIST}\.deviantart\.com/art/#{TITLE}-#{DEVIATION_ID}\z}i
|
||||
|
||||
PATH_PROFILE = %r{\Ahttps?://www\.deviantart\.com/#{ARTIST}/?\z}i
|
||||
PATH_PROFILE = %r{\Ahttps?://(www\.)?deviantart\.com/#{ARTIST}/?\z}i
|
||||
SUBDOMAIN_PROFILE = %r{\Ahttps?://#{ARTIST}\.deviantart\.com/?\z}i
|
||||
|
||||
def self.match?(*urls)
|
||||
@@ -111,7 +117,7 @@ module Sources
|
||||
end
|
||||
|
||||
def normalized_for_artist_finder?
|
||||
url =~ PATH_PROFILE
|
||||
url == normalize_for_artist_finder
|
||||
end
|
||||
|
||||
def normalizable_for_artist_finder?
|
||||
|
||||
@@ -229,5 +229,14 @@ module Sources
|
||||
assert_match(%r!"Print available at Inprnt":\[http://www.inprnt.com/gallery/teemutaiga/kisu\]!, @site.dtext_artist_commentary_desc)
|
||||
end
|
||||
end
|
||||
|
||||
context "An artist entry with a profile url that is missing the 'www'" do
|
||||
should "still find the artist" do
|
||||
@site = Sources::Strategies.find("http://noizave.deviantart.com/art/test-post-please-ignore-685436408")
|
||||
@artist = FactoryBot.create(:artist, name: "noizave", url_string: "https://deviantart.com/noizave")
|
||||
|
||||
assert_equal([@artist], @site.artists)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user