下载google历史 official logos的shell脚本。注:由于GFW的原因,一些图片可能无法下载。
Bash语言:
#!/bin/bash # 下载google official logos的脚本 # 各个网站的 # 被否决的 # # another web for google logo http://google.zdevo.com/catalog.asp?page=1 html_base= image_base= season=(1 2 3 4)
last_century=(98 99)
this_century=(00 01 02 03 04 05 06 07 08 09)
# length: ${#this_century[@]} ${#this_century[*]} # all id: ${!this_century[@]} ${!this_century[*]} download_html()
{ for i in ${last_century[@]} do for j in ${season[@]} do wget -ckp ${html_base}logos$i-$j.html done done for i in ${this_century[*]} do for j in ${season[@]} do wget -ckp ${html_base}logos$i-$j.html done done for ((
i=10; i<=11; ++i))
do for j in ${season[@]} do wget -ckp ${html_base}logos$i-$j.html done done } #分析html里面链接,获取下载链接,下载图片 download_image()
{ mkdir bak_logo_html/ for file in `ls | grep ^logos | grep .html$` do dir=`echo $file | awk -F'-' '{print $1}' | cut -b 6,7` mkdir $dir images=$(cat $file | grep \<img\ alt= | grep /logos/ | awk -F'src="' '{print $2}' | awk -F'"' '{print $1}')
for img in $images do wget -c $image_base$img mv `basename $img` $dir done mv $file bak_logo_html/ done } download_html # 后来废弃这个函数,给wget下载网页时加了一个-k转换链接 -p下载图片 #download_image
阅读(578) | 评论(0) | 转发(0) |