从网址下载图片列表 [英] download list of images from urls

查看:216
本文介绍了从网址下载图片列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到(最好)或为很多图片构建一个应用程序。
每张图片都有一个不同的网址。有成千上万,所以手动做这是一项巨大的努力。
该列表当前位于csv文件中。 (它本质上是一个产品列表,每个产品都有识别信息(名称,品牌,条形码等)和产品图像的链接。
我想循环浏览列表,并下载每个图像文件。理想情况下,我想重命名每一个 - 比如barcode.jpg。
我看过很多图像搜索器,但是没有找到一个可以这样工作的图像。
非常感谢任何导致正确的工具,或想法...

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. The list is currently in an csv file. (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...

推荐答案

你在Windows或Mac / Linux吗?在Windows中你可以使用powershell脚本,在mac / linux上有一个大约1-5行代码的shell脚本。

Are you on Windows or 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.

这是一种方法:

# 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'

现在返回 - 将wget命令替换为shell。

Now back-substitute the wget commands into the shell.

这篇关于从网址下载图片列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆