artstation: accept www.artstation.com/artwork/foo-bar-baz style urls.
This commit is contained in:
@@ -6,8 +6,11 @@ module Sources::Strategies
|
|||||||
self.project_id(url).present?
|
self.project_id(url).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# https://www.artstation.com/artwork/04XA4"
|
||||||
|
# https://dantewontdie.artstation.com/projects/YZK5q"
|
||||||
|
# https://www.artstation.com/artwork/cody-from-sf"
|
||||||
def self.project_id(url)
|
def self.project_id(url)
|
||||||
if url =~ %r!\Ahttps?://\w+\.artstation\.com/(?:artwork|projects)/(?<project_id>[a-z0-9]+)\z!i
|
if url =~ %r!\Ahttps?://\w+\.artstation\.com/(?:artwork|projects)/(?<project_id>[a-z0-9-]+)\z!i
|
||||||
$~[:project_id]
|
$~[:project_id]
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
|
|||||||
@@ -58,5 +58,17 @@ module Sources
|
|||||||
assert_equal("From Gantz.", @site.artist_commentary_desc)
|
assert_equal("From Gantz.", @site.artist_commentary_desc)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "The source site for a www.artstation.com/artwork/$slug page" do
|
||||||
|
setup do
|
||||||
|
@site = Sources::Site.new("https://www.artstation.com/artwork/cody-from-sf")
|
||||||
|
@site.get
|
||||||
|
end
|
||||||
|
|
||||||
|
should "get the image url" do
|
||||||
|
url = "https://cdna.artstation.com/p/assets/images/images/000/144/922/original/cassio-yoshiyaki-cody2backup2-yoshiyaki.jpg?1406314198"
|
||||||
|
assert_equal(url, @site.image_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user