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

 时间:2026-04-22 20:33: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批量抓取百度首页真实网址

  • 如何在百度个人首页添加网址
  • 个性化百度首页链接
  • 百度首页添加常用网址
  • 百度首页怎么添加常用网址
  • 如何将自己常用的网址添加到百度首页
  • 热门搜索
    重生之悠闲生活 如何输入繁体字 小米3怎么拆后盖 什么是爱 官太迷情的生活 手办是什么东西 生活因挫折而精彩 慢性宫颈炎如何根治 大熊猫的生活 怎么看怎么办