shell编写图片抓取器
来源:互联网 发布:淘宝怎么添加花呗支付 编辑:程序博客网 时间:2024/05/16 08:21
最近在看《Linux Shell脚本攻略》一书,书中有个图片抓取器的script,抓取出来记录一下。
适用范围:适合抓取html里符合img标签正则规则的图片。
#!/bin/bashif [ $# -ne 3 ]then echo "Usage: $0 URL -d DIRECTORY" exit -1fifor i in {1..4}do case $1 in -d) shift; directory=$1; shift;; *) url=${url:-$1};shift;esacdonemkdir -p $directorybaseurl=$(echo $url | egrep -o "https?://[a-z.]+")echo "$baseurl"curl -s $url | egrep -o "<img src=[^>]*>" | sed 's/<img src=\"\([^"]*\).*/\1/g' > /tmp/$$.listsed -i "s|^/|$baseurl/|" /tmp/$$.listcd $directory;while read filenamedo echo $filename curl -s -O "$filename" --silentdone < /tmp/$$.list
运行方式:sh ceshi.sh url -d images (cehi.sh为shell script)
0 0
- shell编写图片抓取器
- 基于Shell的图片抓取器
- shell脚本写的一个图片抓取器
- Scrapy 在shell下抓取图片
- 图片抓取
- 抓取图片
- 一个简单的图片抓取器
- shell抓取音频文件
- shell编写
- shell编写
- Shell编写
- shell编写
- shell编写
- shell编写
- 基于WebCollector的java爬虫(二)配合shell+cutycapt抓取糗事百科页面生成图片
- 抓取摄像头图片
- 爬虫抓取网页图片
- DirectShow:图片的抓取
- Gradle DSL method not found android
- 4、struts2 文件上传下载
- Android APP严重卡顿BUG
- git删除远程分支
- Name That Number
- shell编写图片抓取器
- JDBC删除表数据
- studyjams 3B better android
- JS中的prototype
- pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0
- java集合16-HashSet源码走读
- SPFA
- 渗透疑问
- [BZOJ2876] [NOI2012] 骑行川藏 - 数论 - 拉格朗日定理(拉格朗日乘子法) + 二分