批量检测关键词360收录的Shell脚本
开始之前准备关键词文本,一行一个:
例子:
#!/bin/bash
allnum=0
findnum=0
#if [[ $1 == "" ]];
#then
#out="ok.txt"
#else
#out=$1
#fi
file=$1
cat $1|( while read line;
do
let allnum+=1
#echo $a
#echo $line
#url=`echo $line|awk -F '\t' '{print $1}'`
#echo $url
#line=`echo $line|awk -F '\t' '{print $2}'`
line=`echo $line|sed 's/[\r\n\t]//g'`
oldquery=$line
line=${line// /%20}
#echo $line
querynum=`curl -s "https://www.so.com/s?q=$line&src=srp&fr=360sou_newhome"|grep -c '抱歉,未找到'`
#echo $querynum
if [[ $querynum != 1 ]];then
let findnum+=1
echo -e "$oldquery 已收录\r"
fi
done
echo -e "查询总数:$allnum,收录数量: $findnum" )