#!/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))
详细解决方案
百度贴吧签到(基于python3)
热度:63 发布时间:2023-09-06 12:08:10.0
相关解决方案
- Python3.4 解释一段程序时提示SyntaxError: invalid syntax异常
- python3.4 编译时提示异常 IndentationError: unexpected indent
- python3.2运用pywin32连接SQLServer2008
- 在 python3 上为 Ubuntu 安装 NCurses
- Python3.x:从其他类访问self.xxx变量而不继承
- 我该如何抓取所有
内容是什么?(python3.6) - 在 Python3 中不使用 FOR 的模式匹配后返回一个巨大文件的确切行
- 在运行脚本的命令前面使用的“ th”,“ python”,“ python3”,“ java”等是什么?
- Python3.6和单例-用例和并行执行
- 使用 Python3 的 Pipedrive API 将交易输出限制为 1000 笔交易
- 无法在 Linux 上使用 python3 和 cx_Oracle 作为外部识别用户进行连接
- 短语突出显示QEditText PyQt4 Python3
- 打印/获取字典中每个嵌套项目的完整路径 - Python3
- python3.7+anaconda3+vs2015+dlib19.16
- python3 判断列表是否存在某元素
- python3 issubset 判断列表子集
- Python3 虚拟环境激活
- Python3 教程
- python3.7+flask+web学习笔记2
- Python3 socket
- 远程部署神器 Fabric,支持 Python3
- python安装教程(Windows系统,python3.7为例)
- python3-PIL基本概念
- python3.7使用pyinstaller 打包.py文件生成exe文件的种种问题
- python3,python2不同版本下安装PyQt4
- python3.7opencv安装
- python3 字符与ascii转换
- python3 一次输入多个值
- Caffe搭建:Ubuntu14.04 + CUDA7.5 + opencv3.1+python3.5
- 【Python3 OpenCV3.3图像处理教程学习笔记01】读入图像+显示图像+保存图像