
百度做了改版,因此原来网上的top500下载程序不能用了。针对新版百度作了修改。
你只要有一个linux主机,并且有执行shell脚本的权限,就可以一网打尽baidu的top500歌曲。
脚本部分借鉴了:http://spaces.abccba.net/cache/14.htm
主机上需要安装wget,tr,pcregrep ,sed等软件包。
以下是程序清单:
#!/bin/sh
wget http://list.mp3.baidu.com/topso/mp3topsong.html -O mp3topsong.html
cat mp3topsong.html | tr \" \\n | pcregrep 'http:\/\/mp3\.baidu\.com\/.+word=.+\+.*' > list.raw
while read line
do
line=`echo $line\&lm=0`;
wget $line -O temp.html;
songtemp=`cat temp.html | tr \" \\\n | pcregrep 'http:\/\/202\.108\.23\.172\/m'| head -1`;
songtemp=`echo $songtemp|tr [:blank:] %20`;
wget $songtemp -O songtemp.html;
url=`cat songtemp.html | tr \" \\\n | pcregrep mp3$ | pcregrep ^http:// | head -1`;
title=`echo $songtemp| tr '=' \\\n | pcregrep 'baidusg.+\&word' | sed 's/baidusg,//' | sed 's/\&word//'`;
title=`echo $title\.mp3`;
wget $url -O $title;
done < 'list.raw'
: 科技


