百度贴吧签到脚本,Python脚本案例之一,来自吾爱大神编写,能实现百度贴吧一键自动签到功能,支持所有等级的贴吧签到,帮助你轻松挂机升级。本次带来百度贴吧签到脚本下载,使用脚本编辑器编辑即可使用,有需要的朋友们可以试试。
百度贴吧签到脚本作者说明
本脚本为我从网上各渠道搜集到的签到脚本的杂交
如果不需要日志则把带“#日志记录”的行删除即可
百度贴吧签到脚本源码一览
from requests import Session
from time import time#日志记录
start_time = time()
# 数据
log_path = f"E://data/sign_log_{int(start_time)}.txt"#日志记录
like_url = 'https://tieba.baidu.com/mo/q/newmoindex?'
sign_url = 'http://tieba.baidu.com/sign/add'
tbs = '4fb45fea4498360d1547435295'
head = {
'Accept': 'text/html, */*; q=0.01',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Connection': 'keep-alive',
'Cookie': '填入你的百度cookie(百度一下:如何获取百度cookie)',
'Host': 'tieba.baidu.com',
'Referer': 'http://tieba.baidu.com/i/i/forum',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/71.0.3578.98 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest'}
s = Session()
# 获取关注的贴吧
bars = []
dic = s.get(like_url, headers=head).json()['data']['like_forum']
for bar_info in dic:
bars.append(bar_info['forum_name'])
# 签到
already_signed_code = 1101
success_code = 0
need_verify_code = 2150040
already_signed = 0
succees = 0
failed_bar = []
logs = []#日志记录
n = 0
while n < len(bars):
bar = bars[n]
data = {
'ie': 'utf-8',
'kw': bar,
'tbs': tbs
}
try:
r = s.post(sign_url, data=data, headers=head)
except Exception as e:
print(f'未能签到{bar}, 由于{e}。')
failed_bar.append(bar)
continue
dic = r.json()
msg = dic['no']
if msg == already_signed_code: already_signed += 1; r = '已经签到过了!'
elif msg == need_verify_code: n -= 1; r = '需要验证码,即将重试!'
elif msg == success_code: r = f"签到成功!你是第{dic['data']['uinfo']['user_sign_rank']}个签到的吧友,共签到{dic['data']['uinfo']['total_sign_num']}天。"
else: r = '未知错误!' + dic['error']
print(f"{bar}:{r}")
succees += 1
logs.append(dic)#日志记录
n += 1
end_time = time()
t = end_time - start_time
l = len(bars)
failed = "\n失败列表:"+'\n'.join(failed_bar) if len(failed_bar) else ''
print(f'''共{l}个吧,其中: {succees}个吧签到成功,{len(failed_bar)}个吧签到失败,{already_signed}个吧已经签到。{failed}
此次运行用时{t}s。''')
with open(log_path,'w') as f:#日志记录
for log in logs:#日志记录
f.write(str(log)+'\n')#日志记录
相关新闻
贴吧超级会员可以享受在电脑上一键签到的特权(普通用户只要下载手机客户端,同样可以一键签到),那么一键签到有多少经验,怎样在电脑上一键签到呢
一键签到有多少经验?超级会员签到比普通用户多6倍的经验,但是不是按客户端的签到经验算的哦,普通用户电脑签到一次是2经验,超级会员的签到经验就是12经验,如果连续签到,经验值就是14,用客户端签到也是一样的,没有连续为12经验,连续为14经验