自动删除QQ空间指定好友的留言

您所在的位置:网站首页 qq空间如何快速删留言 自动删除QQ空间指定好友的留言

自动删除QQ空间指定好友的留言

2024-07-17 02:42:34| 来源: 网络整理| 查看: 265

 

你是否也有过,想删除QQ空间里某个人的对自己发表的说说的全部评论,但又因说说太多,手动查找再删除太过麻烦?OK,我也有这个需求,成品分享给你。

 

如果想自己琢磨呢,源码在文末;如果想直接使用呢,exe已上传,不用积分即可下载。

 

 

一、使用本程序,需要提供4个内容:你的QQ号、对方的名称、g_tk和cookie。

1、你的QQ号

就是你的QQ号,复制到conf.json文件

 

2、对方的名称

要删除的对方的备注或昵称(ta在你空间所显示的名称),一般如果你设置了备注,就是备注名;没设置备注,就是他的网名。复制到conf.json文件。可以多个好友,以英文逗号分隔。

 

3、g_tk

a. 首先手动登陆你的QQ空间

 

b. 点进“我的主页”

 

c. 按F12,选中network(有的浏览器显示是“网络”)

 

d. 刷新一下浏览器,点击有html的一项

 

e. 最下面就有g_tk了,复制到conf.json文件

界面先不要关

 

4、cookie

g_tk获取完,上面就有cookie,复制到conf.json文件

 

二、运行程序

 

三、源码

import time import requests import json with open('conf.json', 'r', encoding='utf-8') as f: content = f.read() msg = json.loads(content) print(msg) # 你的QQ号 QQ = msg['QQ'] # 浏览器打开QQ空间,按F12,找到g_tk g_tk = msg['g_tk'] # 要删除的对方的备注或昵称(ta在你空间所显示的名称) targetname = msg['name'].split(',') # 浏览器打开QQ空间,按F12,找到cookie cookie = msg['cookie'] print('@'*60) print('>> 你的QQ:', QQ) print('>> 对方名称:', targetname) print('@'*60) print('>> 开始运行') print() headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36', 'cookie': cookie } def getcomment(): delcnt = 0 delmsg = [] totalcomment = 20 pos = 0 while pos < totalcomment: print('#' * 60) print(">> 当前位置:", pos) url = 'https://user.qzone.qq.com/proxy/domain/taotao.qq.com/cgi-bin/emotion_cgi_msglist_v6?uin={0}&inCharset=utf-8&outCharset=utf-8&hostUin={0}¬ice=0&sort=0&pos={1}&num=20&cgi_host=https%3A%2F%2Fuser.qzone.qq.com%2Fproxy%2Fdomain%2Ftaotao.qq.com%2Fcgi-bin%2Femotion_cgi_msglist_v6&code_version=1&format=json&need_private_comment=1&g_tk={2}'.format(QQ, pos, g_tk) pos += 20 html = requests.get(url, headers=headers).json() totalcomment = int(html['total']) print('>> 总共条数:', totalcomment) msglist = html['msglist'] for item in msglist: try: commentlist = item['commentlist'] conlist = item['conlist'] if conlist: conlist = conlist[0]['con'] print(">> 发布的说说:", conlist) else: print(">> 发布仅为图片") topicId = QQ+'_' + item['tid'] print(">> topicId:", topicId) for i in commentlist: content = i['content'] name = i['name'] createTime = i['createTime'] commentId = commentlist.index(i)+1 print(">> 评论{}: ({}){}\t{}".format(commentId, createTime, name, content)) if name in targetname: print(">> 删除本条留言") delcomment(topicId, commentId) delcnt += 1 delmsg.append(content) print() except: pass time.sleep(1) print('*' * 60) print('共删除条数:', delcnt) print('共删除内容:', delmsg) print('*' * 60) def delcomment(topicId, commentId): url = 'https://user.qzone.qq.com/proxy/domain/taotao.qzone.qq.com/cgi-bin/emotion_cgi_delcomment_ugc?g_tk={0}'.format(g_tk) data={ 'uin': QQ, 'hostUin': QQ, 'topicId': topicId, 'commentId': commentId, 'inCharset':'', 'outCharset':'', 'ref':'', 'hostuin': QQ, 'code_version': '1', 'format': 'fs', 'qzreferrer': 'https://user.qzone.qq.com/proxy/domain/qzs.qq.com/qzone/app/mood_v6/html/index.html#mood&g_iframeUser=1&g_iframedescend=1&uin={0}&pfid=2&qz_ver=8&appcanvas=0&qz_style=31¶ms=&entertime=1588985689146&canvastype=&cdn_use_https=1'.format(QQ) } html = requests.post(url, headers=headers, data=data) time.sleep(1) html = requests.post(url, headers=headers, data=data) if '对不起,原文已经被删除,无法查看' in html.text: print('原文已经被删除') try: getcomment() except Exception as e: print(e) input(">> 任意键退出...")

 

 

 

 



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭