教程集 www.jiaochengji.com
教程集 >  脚本编程  >  shell  >  正文 批量下载人人网好友的某一相册的shell脚本

批量下载人人网好友的某一相册的shell脚本

发布时间:2014-08-24   编辑:jiaochengji.com
批量下载人人网好友的某一相册的shell脚本,有需要的朋友,可以参考下。

本文仅作为学习shell脚本之用。
1.首先进入到好友的某一个相册;

2.然后鼠标右键,选择“View Page Source”(我使用的是firefox,具体的看自己的情况了),将所有内容保存到一个命名为mytest.html的文件(文件名可以自己选择,修改后更改脚本文件);

3.写下以下脚本:
 

复制代码 代码如下:

#!/bin/sh
# function:download friends' pictures from renren.com
# author:Sam.Wu
# date:2012-9-16
# version:v1.0

spilt_key='data-photo'

function spilt_message(){
grep -R $spilt_key mytest.html > tmp_grep_url.log
awk -F '[<>]' '{for(i=1;i<=NF;i++) {if($i~/'$spilt_key'/){print $i}}}' tmp_grep_url.log > tmp_photo_url.log
awk -F "['']" '{print $4}' tmp_photo_url.log > photo_url.log
}

if [ !-d testdir ];then
mkdir testdir
fi

spilt_message

while read line
do
echo $line
wget $line -P ./testdir
done < photo_url.log

rm -rf *.log

4.执行脚本,图片存放于testdir目录(根据自己的需求修改)。

您可能感兴趣的文章:
批量下载人人网好友的某一相册的shell脚本
shell批量修改文件后缀名
深入解析tcsh的初始化配置文件
shell脚本向mysql表批量插入数据
python shell是什么
inux shell初级入门教程
将PHP作为Shell脚本语言使用
linux命令行bash批量重命名文件
与个人网站拜把做兄弟 搜索门户一片光明
python怎么调用youget

[关闭]
~ ~