artstation: include only images in image_urls.
This commit is contained in:
@@ -54,7 +54,8 @@ module Sources::Strategies
|
|||||||
@json = JSON.parse(resp.body)
|
@json = JSON.parse(resp.body)
|
||||||
@artist_name = json["user"]["username"]
|
@artist_name = json["user"]["username"]
|
||||||
@profile_url = json["user"]["permalink"]
|
@profile_url = json["user"]["permalink"]
|
||||||
@image_urls = json["assets"].map do |x|
|
images = json["assets"].select { |asset| asset["asset_type"] == "image" }
|
||||||
|
@image_urls = images.map do |x|
|
||||||
y, _, _ = image_url_rewriter.rewrite(x["image_url"], nil)
|
y, _, _ = image_url_rewriter.rewrite(x["image_url"], nil)
|
||||||
y
|
y
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -70,5 +70,17 @@ module Sources
|
|||||||
assert_equal(url, @site.image_url)
|
assert_equal(url, @site.image_url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "The source site for an ArtStation gallery" do
|
||||||
|
setup do
|
||||||
|
@site = Sources::Site.new("https://www.artstation.com/artwork/BDxrA")
|
||||||
|
@site.get
|
||||||
|
end
|
||||||
|
|
||||||
|
should "get only image urls, not video urls" do
|
||||||
|
urls = %w[https://cdnb.artstation.com/p/assets/images/images/006/037/253/original/astri-lohne-sjursen-eva.jpg?1495573664]
|
||||||
|
assert_equal(urls, @site.image_urls)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user