Linux · 2009-04-26

shell脚本查询百度收录及alexa排名

shell批量查询网站的排名及收录情况..多个网站依葫芦画瓢就可以,不是什么好东西,自己乱搞一通,为的就是方便.用到的工具有curl跟wget,把路径换成你自己的,就可以用了..

#!/bin/bash
cd /root/get_site_info
$(curl http://alexa.chinaz.com/?domain=baiqiuyi.com -o alexa.temp && cat alexa.temp |iconv -f gb2312 -t utf8|grep 综合排名|sed -e 's/<[^>]*>//g' -e 's/^[ \t]*//g' -e 2d > today.result && rm alexa.temp)
$(wget -q http://www.baidu.com/s?wd=site%3Abaiqiuyi.com -O baiqiuyi.temp)
$(cat baiqiuyi.temp|iconv -f gb2312 -t utf8 -o baiqiuyi.html || rm baiqiuyi.temp)
$(sed -e '/百度一下/!d' -e 's/<[^>]*>//g' -e 's/ //g' -e '1,2d' baiqiuyi.html >> today.result && echo $(date) >> today.result && rm baiqiuyi.html)
clear
cat /root/get_site_info/today.result
#wall <