当前位置: 代码迷 >> 综合 >> 百度贴吧签到(基于python3)
  详细解决方案

百度贴吧签到(基于python3)

热度:63   发布时间:2023-09-06 12:08:10.0
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
# 需要修改kw_list值跟cookie值【登陆百度F12获取】import json
import requests
from urllib import parsekw_list=["青岛北站","鲁南高铁","非全日制研","学士学位","曲阜师范大学研究生","金鸡百花电影节","河套街道","荣威rx3","沂南一中","希腊","正商","山东联通","乌克兰","中华城市","青岛公交","软件考试","正商蓝海港湾","白沙上苑","高密","杜晓伟","爱沙尼亚","拉脱维亚","津巴布韦","奇瑞","知乎","沂南","雪娥","程潇","lantern","papi酱","兰山","河东","红岛","李沧","青岛高新区","市南","市北","尚硅谷","装修","chrome","崂山","中国海洋大学","青岛大学","驴友","考研","青岛科技大学","城阳","新加坡","济南","苍月","杜","覃沐曦","黄岛","曲阜师范大学","临沂","andriod","javascript","java","php","wifi破解","胡辰","毕向东","蚂蚁聚宝","罗辑思维121","罗辑","高晓松","dnf山东五区","李毅","火影忍者","历史","曲阜师范大学日照校区","胥渡","歌曲","动听漫音","地下城与勇士","陈乔恩","青岛","iphone","北京","清华大学","日照","非诚勿扰","潘时七","罗辑思维","杜甫","李白","贴吧意见反馈吧","非全日制研究生","12306"]
url_qd="https://tieba.baidu.com/sign/add";
cookie="BAIDUID=DFA4DCCCFDEB861B4BC747CB75E07132:FG=1; PSTM=1565660536; BIDUPSID=DFA4DCCCFDEB861B4BC747CB75E07132; BDUSS=kJWVEl5U3JsbXNpREx-c3k0LUloRmFWdkhuQ0JkLWdqeUhoSWtZcjEwcGo3TGhkSVFBQUFBJCQAAAAAAAAAAAEAAADRO5AP0NDV3zUyOTIwODIxNQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGNfkV1jX5FdQ; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BDSFRCVID=hk8OJeCinZwtw3owNsz7JIUjGeKK0NJTH6eCprQKl5boIZIfyOUKEG0P_x8g0KubLia6ogKKymOTHrAF_2uxOjjg8UtVJeC6EG0Ptf8g0f5; H_BDCLCKID_SF=tJFfoK0afIK3DPJNh4Q2MDCS5h50bI62aKDsQxJnBhcqEn6Sj4kBD5QW5UJy-lvZWGTBKb5cWKJJ8UbS-lCbXlbye-682h3haJbpaJ5nJq5nhMJmb67JDMP0-xOtJRcy523ion3vQpP-OpQ3DRoWXPIqbN7P-p5Z5mAqKl0MLPbtbb0xXj_0D6JQjaLtJTDsb5vfsD-MtIP2hKtxD50_-P4DeU7WqURZ5m70Wfc5bP05DP38KnCbyxFAM4J-BMPjBeQnaIQH0-JKVqv1jt5oyqIPblr9Lxn43bRTM-Py5KJvfJosMtL-hP-UyprLWh37-e6lMKoaMp78jR093JO4y4Ldj4oxJpOJ5JbMonLafJOKHIClj58Kjx5; H_PS_PSSID=1437_21092_30210_30125; delPer=0; PSINO=5; pgv_pvi=4750146560; pgv_si=s265460736; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; MCITY=-236%3A; ZD_ENTRY=baidu"header={"Content-Type":"application/x-www-form-urlencoded","Cookie":cookie};
k = 0
j = 0
new_kw_list=[]
for i in range(len(kw_list)):data_qd=parse.urlencode({"ie":"utf-8","kw":kw_list[i],"tbs":"2f779a8c487927b51575947566"})response = requests.post(url_qd, data=data_qd,headers=header)json_rsp = response.json()json_rsp = {"error":""}if json_rsp["error"]=="":k=k+1elif json_rsp["error"]=="贴吧目录出问题啦,请到贴吧签到吧反馈":new_kw_list.append(kw_list[i])data_qd2=urllib.urlencode({"ie":"utf-8","kw":new_kw_list[i],"tbs":"2f779a8c487927b51575947566"})response2 = requests.post(url_qd, data=data_qd2,headers=header)json_rsp2 = response2.json()if json_rsp2["error"] == "":k = k + 1else:j = j + 1print("_____")print(kw_list[i])print("两次都没签到成功!")print(urllib.unquote(json_rsp["error"]))print("_____")elif json_rsp["error"]=="亲,你之前已经签过了":k = k + 1else:j = j + 1print("_____")print(kw_list[i])print("进入else!签到失败")print(urllib.unquote(json_rsp["error"]))print("_____")
print("一共签到:"+str(i+1)+"个吧")
print("成功次数:"+str(k))
print("失败次数:"+str(j))
  相关解决方案