标题: 【工具】 眼不见为净之删除自己所有回复
时间: 2019-09-08发布,2019-09-08修改
我只是自己写了个小脚本分享出来,希望能帮助到有需要的人。可能是由于我的技术不够到位,这样也能被人杠,就很神奇
---分割线---
闲来无事,做个一个小工具把自己的回复删除了。
https://github.com/nic329/hu60wap6_del
# coding=utf-8
import requests
import threading, time
import json
import re
from urllib import quote
cookie = ''
username = ''
def getlist(p):
print "<第"+str(p)+"页><start>"
url = "https://hu60.cn/q.php/bbs.search.json?keywords=&username="+quote(username)+"&searchType=reply&p="+str(p)
ret = requests.get(url).content
data = (json.loads(ret))['replyList']
for item in data:
if item['locked'] == 1 : continue
del_reply(item)
print "<第" + str(p) + "页><end>"
def del_reply(item):
url = "https://hu60.cn/q.php/bbs.deltopic."+str(item['topic_id'])+"."+str(item['id'])+".html"
ret = requests.get(url, cookies={'hu60_sid': cookie}).content
r = re.search(r'token\" value=\"(.*)\"', ret)
token = r.group(1)
ret = requests.post(url, cookies={'hu60_sid': cookie}, data={'token': token, 'go': '确认删除'}).content
print "[" + str(item['id']) + "]" + "-->",
if "删除成功" in ret: print ['ok']
else: print '[unknown]'+url
def start():
threads = []
ret = requests.get("https://hu60.cn/q.php/bbs.search.json?keywords=&username="+quote(username)+"&searchType=reply").content
end = json.loads(ret)['maxPage']
print '[共'+str(end)+'页]'
for i in range(1, end+1):
threads.append(threading.Thread(target=getlist,args=(i,)))
for t in threads:
t.start()
time.sleep(3)
for t in threads:
t.join()
def login(user, password):
ret = requests.post("https://hu60.cn/q.php/user.login.html?u=index.index.html", data = {'type':1, 'name': user, 'pass': password, 'go': '登录'})
if "欢迎" in ret.content:
global cookie, username
username = user
cookie = ret.cookies['hu60_sid']
return 1
else:
return 0
if __name__ == '__main__':
user = raw_input('输入用户名:')
password = raw_input('输入密码:')
if login(user, password) == 1 :
print '[登录成功]'
start()
else:
print '【登录失败】'
exit(0)
『回复列表(3|隐藏机器人聊天)』