大于x kb的Wget图像 [英] Wget images larger than x kb

查看:22
本文介绍了大于x kb的Wget图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以仅下载大于指定KB的图像?

我现在有这个: Wget-r-P下载/位置-U Mozilla-A jpeg,jpg,bmp,gif,pnghttp://www.website.com

致以亲切的问候, N00ble

WGET

WGET的递归下载没有大小选项,但您可以爬行到图像URL列表,您可以检查它们的Content-Length以供下载。您可以在bash脚本中执行此操作。

#Retrieve image URLs from site
image_urls=`wget --spider --force-html -r -l2 "http://www.website.com" 2>&1 | grep '^--' | awk '{ print $3 }' | grep '.(jpeg|jpg|bmp|gif|png)$'`
for image_url in $image_urls
do
  size=`wget -d -qO- "$image_url" 2>&1 | grep 'Content-Length' | awk {'print $2'}`
 #download only download images less than 100,000 bytes
  if [[ $size < 100000 ]] ;then 
    wget $image_url
  fi
done

这篇关于大于x kb的Wget图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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