Skip to content

Commit aaafbc8

Browse files
authored
Update qq_strip.py
1 parent e044dfb commit aaafbc8

1 file changed

Lines changed: 26 additions & 16 deletions

File tree

Python/reptile/qq_strip.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,29 @@
1212
'Cookie': cookie}
1313
proxies = {'http':'http://27.185.194.55:8118'}
1414
times = 0
15-
while True:
16-
print("第 {} 页".format(((times//10)+1)))
17-
print("----------------------------------------")
18-
url = "https://h5.qzone.qq.com/proxy/domain/m.qzone.qq.com/cgi-bin/new/get_msgb?uin=1473018671&hostUin=1473018671&num=10&start={}&hostword=0&essence=1&s={}&iNotice=0&inCharset=utf-8&outCharset=utf-8&format=jsonp&ref=qzone&g_tk=159637896&qzonetoken=2a26403b960220332f267c6736eec1e4053e1f6eb5791eb2fe314429eb084741d2f4b70466ac0e7f1c".format(str(times),numpy.random.random())
19-
# url地址要自己去开发者工具里面拿~上面的这个是我自己的~复制自己的修改一下就行了~
20-
regs = requests.get(url, proxies=proxies, headers=header)
21-
str_qiepian = regs.text[10:-3]
22-
js = json.loads(str_qiepian)['data']['commentList']
23-
if js == []:
24-
print("Over! 共计 {} 页".format(json.loads(str_qiepian)['data']['total']))
25-
break
26-
else:
27-
for page in range(len(js)):
28-
print("第{}页的第{}条 留言者:{} \t 内容:{}".format((times//10)+1,page+1,js[page]['nickname'],js[page]['ubbContent']))
29-
times+=10
30-
time.sleep(numpy.random.random())
15+
if cookie == "":
16+
print("请输入cookie!")
17+
else:
18+
while True:
19+
print("第 {} 页".format(((times//10)+1)))
20+
print("----------------------------------------")
21+
url = "https://h5.qzone.qq.com/proxy/domain/m.qzone.qq.com/cgi-bin/new/get_msgb?uin=1473018671&hostUin=1473018671&num=10&start={}&hostword=0&essence=1&s={}&iNotice=0&inCharset=utf-8&outCharset=utf-8&format=jsonp&ref=qzone&g_tk=159637896&qzonetoken=2a26403b960220332f267c6736eec1e4053e1f6eb5791eb2fe314429eb084741d2f4b70466ac0e7f1c".format(str(times),numpy.random.random())
22+
# url地址要自己去开发者工具里面拿~上面的这个是我自己的~复制自己的修改一下就行了~
23+
regs = requests.get(url, proxies=proxies, headers=header)
24+
str_qiepian = regs.text[10:-3]
25+
try:
26+
js = json.loads(str_qiepian)['data']['commentList']
27+
except json.decoder.JSONDecodeError:
28+
print("请更换url地址,地址中的qzonetoken验证和g_tk有变")
29+
break
30+
except KeyError:
31+
print("请更换cookie!")
32+
break
33+
if js == []:
34+
print("Over! 共计 {} 页".format(json.loads(str_qiepian)['data']['total']))
35+
break
36+
else:
37+
for page in range(len(js)):
38+
print("第{}页的第{}条 留言者:{} \t 内容:{}".format((times//10)+1,page+1,js[page]['nickname'],js[page]['ubbContent']))
39+
times+=10
40+
time.sleep(numpy.random.random())

0 commit comments

Comments
 (0)