Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
download all the listing images from a given etsy shop
require 'etsy'
Etsy.api_key = '<api-key>'
shop = Etsy::Shop.find '<shop-name>'
out_dir = '<output-directory>'
Etsy.environment = :production
Dir.mkdir out_dir unless File.exists? out_dir
listings = []
offset = 0
nListings = listings.length
listings.concat Etsy::Listing.find_all_by_shop_id(, :limit => 100, :offset => offset)
offset += 100
end while listings.length > nListings
images = {|l| {|i| i.full } }
images.flatten! do |image_url|
uri = URI.parse image_url
out_file = File.join out_dir, File.basename(uri.path)
unless File.exists? out_file
response = Net::HTTP.get_response uri, "w"){|f| f.write response.body }
Copy link

Queensesa commented Jul 28, 2021

someone who can help me with this? Pleaaaaase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment