shell批量抓取百度首页真实网址

2025-10-19 06:37:04

1、以关键词:seo为诸召例

# curl -s "http://www.baidu.com/s?ie=UTF-8&wd=seo"|grep  -o -E "\"url\":\"http://www.baidu.com/link\?url=[a-z0-9A-Z_-]+\""|awk -F "\"" '{print $4}'

取得自己所需要的url

shell批量抓取百度首页真实网址

2、测试一条,是否能抓取真实网址

# curl -I -L -s http://www.baidu.com/link?url=8il2aAP_H9tDzpZMOPccNTiHoyw00yujefXkmQM2Gdy|grep Location|sed 讨侵 's/Location://'

结果显示是可侨蕉趣行的。

shell批量抓取百度首页真实网址

1、将需要抓取的关键词,存入txt文档,一行一个,utf-8格式

列:1.txt

shell批量抓取百度首页真实网址

2、批量采集

# cat 1.txt|while read line;do echo $line;curl -s "http://www.baidu.com/s?ie=UTF-8&wd="$line|grep  -o -E "\"url\":\"http://www.baidu.com/link\?url=[a-z0-9A-Z_-]+\""|awk -F "\"" '{print $4}' >  2.txt;cat 2.txt|while read line;do curl -I -L -s $line|grep Location|sed  's/Location://';done;done

shell批量抓取百度首页真实网址

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢