|
#!/bin/bash
# version-1.1
# Leo lee lxz3002@yahoo.com.cn
# 2006.07.15
#
TEMP_DIR=top500
TOP500_PAGE=top500.page
TOP500_LIST=top500.list
SEARCH_PAGE=search.page
SEARCH_LIST=search.list
echo "------www.baidu.com top500 auto downloader------"
export LC_ALL=zh_CN
# create a temprary directory
if [ -e $TEMP_DIR ]
then
echo "$TEMP_DIR exists"
else
mkdir $TEMP_DIR
if [ "$?" -eq "1" ]
then
echo "mkdir failed! "
exit 1
fi
fi
cd $TEMP_DIR
echo "wgetting top500 page to $TOP500_PAGE"
echo
wget http://list.mp3.baidu.com/topso/mp3topsong.html -O $TOP500_PAGE
echo -n "translating $TOP500_PAGE to $TOP500_LIST ... "
cat $TOP500_PAGE | sed -e '/"http:\/\/mp3.baidu.com\/m?tn=baidump3.*+.*"/!d' -e 's/^.*href="//g' -e 's/" *target.*$//g' | gawk 'BEGIN{ FS="\"" }; { print $1 }' > $TOP500_LIST
echo "Good :-)"
# top500
for CUR in `cat $TOP500_LIST`
do
wget $CUR -O $SEARCH_PAGE
#get search page
echo -n "Translating $SEARCH_PAGE to $SEARCH_LIST ... "
cat $SEARCH_PAGE | grep '^<a.*http://220\.181\.27\.54' | sed -e 's/^.* title.*http:\/\///g' -e 's/".*$//g' | gawk 'BEGIN{FS=" "};{print $1}' > $SEARCH_LIST
echo "Good :-)"
for INST in `cat $SEARCH_LIST`
do
if wget $INST
then
break
fi
done
done
# Cleaning up temp files
rm -f $TOP500_PAGE
rm -f $TOP500_LIST
rm -f $SEARCH_PAGE
rm -f $SEARCH_LIST |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|