#导入包
import requests
import re
import sys
#设置代理浏览器和cookies
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd)
hds={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0'}
cks={你的cookies数据}
page_value=20
sum=0
for i in range(0,20):
print("\n\n\t\t================第"+str(i+1)+"页==============\n\n")
url="https://user.qzone.qq.com/proxy/domain/taotao.qq.com/cgi-bin/emotion_cgi_msglist_v6?uin=2634083023&inCharset=utf-8&outCharset=utf-8&hostUin=2634083023¬ice=0&sort=0&pos="+str(sum)+"&num=20&cgi_host=https%3A%2F%2Fuser.qzone.qq.com%2Fproxy%2Fdomain%2Ftaotao.qq.com%2Fcgi-bin%2Femotion_cgi_msglist_v6&code_version=1&format=jsonp&need_private_comment=1&g_tk=1901890863&qzonetoken=9ed31965063ca37130e4769304082f5897815777c88d9491519d32750769e63cd6da6fe656baa3d64c32"
res=requests.get(url,headers=hds,cookies=cks)
pat='conlist".*?"content":"(.*?)createTime'
rst=re.compile(pat,re.S).findall(res.text)
for j in range(0,len(rst)):
print("------------------------第"+str(j+1)+"条-----------------------------")
rst2=re.sub("\[.*?em.*?\].*?\/em.*?\]","",rst[j])
print(str(rst2).translate(non_bmp_map))
sum+=page_value
总结:本脚本是用来爬取qq空间本人说说的数据,可以爬取从你发说说以来,你所用的数据,该脚本我没有爬取当前说说的编写时间,之后更新,该脚本可用来爬取女朋友或者知道的其他人发表说说的内容