互联网和街边的电线杆一样,能出现自定义信息的位置都是广告的重灾区,站长会关注流量统计工具的数据,那么就有人千方百计的想让自己的信息出现在统计工具里。我多次在自己的统计后台看到买这个百度统计刷搜索词和来路链接/cnzz刷搜索词和来路链接的,本着能自己动手就不花钱的原则研究了一下,其实比较简单。
重点是百度统计和cnzz的id难的,我尝试过怕百度的搜索结果,服务器的域名,进一步挖掘id,都杯水车薪,以至于代码放了两年没有施展空间。现在分享给大家学习,原理很简单,百度统计和cnzz推送就是一个简单的两次get。
百度统计刷搜索词和来路链接代码
import requests
import time, datetime,re
import random
aa=int(time.time())
print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) )
keyword='武汉seo www.hekaiyu.cn'
baidu_id='45be2d728a7c0afeca7f3272ab592ebe'
reurl='http://www.hekaiyu.cn/'
header={
'Connection':'keep-alive',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
'Accept':'image/webp,image/apng,image/*,*/*;q=0.8',
'Referer':reurl,
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-CN,zh;q=0.9',
'Cookie':'cna=kdhFFLBy91ECAXE5QkrS5z3h; UM_distinctid=16762aa44002fd-065a87850ef3b4-333b5602-1fa400-16762aa44025c9',
}
header1={
'Connection':'keep-alive',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
'Accept':'image/webp,image/apng,image/*,*/*;q=0.8',
'Host':'hm.baidu.com',
'If-None-Match': 'd70bc8a6b4ecf7b0a3586a0f0bcc532f',
'Referer': 'http://www.hekaiyu.cn/sem/4626.html',
'Sec-Fetch-Dest': 'script',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Site':'cross-site'
}
url='https://hm.baidu.com/hm.gif'
jshtml=requests.get('https://hm.baidu.com/hm.js?{}'.format(baidu_id) ,headers=header1)
pattern = re.compile(r'hca:\'(.*?)\',conv')
hac=pattern.findall(jshtml.text)
print (hac[0],int(time.time()));
payload = {
'hca': hac[0],
'cc': 1,
'ck': 1,
'cl': '24-bit',
'ds': '1549x872',
'vl': 150,
'ep': '619951,15568',
'et': 0,
'ja': 0,
'ln': 'zh-cn',
'lo': 0,
'lt': int(time.time()),
'rnd': random.randint(1,9999999999),
'si': baidu_id,
'su':'https://www.baidu.com/link?url=yTdMUfvKXbrLSKsXbdtiuh5Caw0rF6-12IL6SR0HrOy&wd={}&eqid=a0ebf1180000fe0e000000055edcb015'.format(keyword) ,
'v': '1.2.74',
'lv': 3,
'sn': 57594,
'r': 0,
'ww': 1550,
'ct': '!!',
'tt': 'SEM竞价优化-信息流广告-SEO优化投放学习平台 - 开水网络'
}
baidu=requests.get(url,headers=header, params=payload)
print (baidu.text)
cnzz刷搜索词和来路链接代码
import requests
import time, datetime
import random
aa=int(time.time())
print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) )
keyword='sem优化 www.hekaiyu.cn'
cnzz_id='1253637370'
reurl='http://www.hekaiyu.cn/'
header={
'Connection':'keep-alive',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
'Accept':'image/webp,image/apng,image/*,*/*;q=0.8',
'Referer':reurl,
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-CN,zh;q=0.9',
'Cookie':'cna=kdhFFLBy91ECAXE5QkrS5z3h; UM_distinctid=16762aa44002fd-065a87850ef3b4-333b5602-1fa400-16762aa44025c9',
}
payload = {
'id':cnzz_id,
'r':'https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd={}&oq={}&rsv_pq=df160dc800043b60&rsv_t=f4c2pYJqrGEXgUog1SrHIQ0dQ5Pyjmj5m5KoW5ArURscsl3LTWvvPndjrd4&rqlang=cn&rsv_enter=0'.format(keyword,keyword),
'lg':'zh-cn',
'ntime':aa,
'cnzz_eid':'1188536334-1539909621-null',
'showp':'1920x1080',
't':'SEM竞价优化-信息流广告-SEO优化投放学习平台 - 开水网络',
'umuuid':'16689d91ec147a-07c48b212fb5b1-333b5602-1fa400-16689d91ec2587',
'h':'1',
'rnd':random.randint(1,9999999999),
}
url='http://z1.cnzz.com/stat.htm'
cnzz=requests.get('http://c.cnzz.com/core.php?web_id={}&show=pic&t=z'.format(cnzz_id),headers=header)
cnzz=requests.get(url,headers=header, params=payload)
print (cnzz.text)
内容好多,看起来很高级的样子
怎么设置才能屏蔽百度后台这种刷的搜索词呢?看数据的时候很烦人
@zyc 指望平台升级了
原来是这样的,经常遇到