刷博客浏览量
import time
import requests
import datetime
article_id_list = [“104451026”, “104061943”, “102649428”, “100637109”, “100186409”, “81750818”, “85873527”,
“81211908”, “104467649”]
code = 200
while code == 200:
for key in article_id_list:
url = “https://blog.csdn.net/weixin_42792621/article/details/{id}” .format(id=key)
headers = {
“authority”: “blog.csdn.net”,
“method”: “GET”,
“path”: “/weixin_42792621/article/details/{id}”,
“scheme”: “https”,
“accept”: “text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9”,
“accept-encoding”: “gzip, deflate, br”,
“accept-language”: “zh-CN,zh;q=0.9”,
“cache-control”: “max-age=0”,
“cookie”: “此处自己调浏览器开发者界面,抓包,拿自己当前cookies就行”,
“referer”: “https://mp.csdn.net/console/article”,
“user-agent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
}
headers [“path”] = headers [“path”].format(id=key)
response = requests.get(url=url , headers=headers )
print(new_url)
print(new_headers[“path”])
print(response.status_code, key, datetime.datetime.now().strftime(’%Y-%m-%d %H:%M:%S’))
code = response.status_code
time.sleep(60)
del new_url, new_headers
解释以上代码重点注意项:
1. Cookies 自己抓包粘进去就行,刷个浏览不用搞那么麻烦
2. Headers里 path 属性要动态构造自己文章ID
3. URL 自己动态构造
4. 一定要睡一段时间在请求,慢慢刷,别急,太快单IP没效果
5. article_id_list 这东西是文章Id,看自己文章URL地址
6. Headers里 path 属性记得改成自己抓包的
这段代码随便改改放到服务器就行
nohup python3 csdn_pv.py &
挂到后台慢慢刷就行,不用管-。-