简体   繁体   English

从网址下载图像列表

[英]download list of images from urls

I need to find (preferably) or build an app for a lot of images.我需要为大量图像查找(最好)或构建一个应用程序。 Each image has a distinct URL. There are many thousands, so doing it manually is a huge effort.每个图像都有一个独特的 URL。有数千个,因此手动完成是一项巨大的工作。 The list is currently in an csv file.该列表当前位于 csv 文件中。 (It is essentially a list of products, each with identifying info (name, brand, barcode, etc) and a link to a product image. I'd like to loop through the list, and download each image file. Ideally I'd like to rename each one - something like barcode.jpg. I've looked at a number of image scrapers, but haven't found one that works quite this way. Very appreciative of any leads to the right tool, or ideas... (它本质上是一个产品列表,每个产品都有识别信息(名称、品牌、条形码等)和产品图像的链接。我想遍历列表,并下载每个图像文件。理想情况下我会喜欢重命名每个 - 像 barcode.jpg 之类的东西。我看过很多图像抓取工具,但还没有找到一个以这种方式工作的。非常感谢任何导致正确工具或想法的线索......

Are you on Windows or Mac/Linux? 您使用Windows还是Mac / Linux? In Windows you can use a powershell script for this, on mac/linux a shell script with about 1-5 lines of code. 在Windows中,您可以为此使用powershell脚本,在mac / linux上,可以使用具有大约1-5行代码的shell脚本。

Here's one way to do this: 这是执行此操作的一种方法:

# show what's inside the file
cat urlsofproducts.csv

http://bit.ly/noexist/obj101.jpg, screwdriver, blackndecker
http://bit.ly/noexist/obj102.jpg, screwdriver, acme

# this one-liner will GENERATE one download-command per item, but will not execute them
perl -MFile::Basename -F", " -anlE "say qq(wget -q \$F[0] -O '\$F[1]--\$F[2]--).  basename(\$F[0]) .q(')" urlsofproducts.csv 



# Output :
wget http://bit.ly/noexist/obj101.jpg -O ' screwdriver-- blackndecker--obj101.jpg'
wget http://bit.ly/noexist/obj101.jpg -O ' screwdriver-- acme--obj101.jpg'

Now back-substitute the wget commands into the shell. 现在,将wget命令代入shell。

If possible please use google sheets to run a function for this kind of work, I was also puzzled on this one and now found a way to by which the images are not only downloaded but those are renamed on the real time.如果可能,请使用 google sheets 运行 function 来完成此类工作,我对此也感到困惑,现在找到了一种不仅可以下载图像,还可以实时重命名图像的方法。

Kindly reply if you want the code.如果你想要代码,请回复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM