本网站提供资源工具下载,老表资源工具,表哥资源网软件工具,老表哥资源下载,活动线报福利资源分享,活动线报,大型网游经典游戏,网络热门技术游戏辅助交流与分享。
首页 > 技术教程 > 自动删除扣扣空间说说和留言本上指定好友的留言

自动删除扣扣空间说说和留言本上指定好友的留言

自动删除扣扣空间说说和留言本上指定好友的留言

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

如果想自己琢磨,源码在文末;如果想直接使用,exe链接在文末。


一、使用本程序,需要提供4个内容:你的扣扣号、对方的名称、g_tk和cookie。
1、你的扣扣号
就是你的扣扣号,复制到conf.json文件
2、对方的名称
要删除的对方的备注或昵称(ta在你空间所显示的名称),一般如果你设置了备注,就是备注名;没设置备注,就是他的网名。复制到conf.json文件。可以多个好友,以英文逗号分隔。

3、g_tk
a. 首先手动登陆你的扣扣空间

b. 点进“我的主页”

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

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

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

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


三、下载链接


https://lanzous.com/b09r14a8f
密码:ev8y



扣扣截图20200509212644.png扣扣截图20200509212651.png扣扣截图20200509212711.png扣扣截图20200509212723.png扣扣截图20200509212732.png扣扣截图20200509212745.png扣扣截图20200509212756.png扣扣截图20200509212802.png扣扣截图20200509212842.png


四、源码

[Python] 纯文本查看 复制代码
?
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import time
import re扣uests
import json
 
with open('conf.json', 'r', encoding='utf-8') as f:
    content = f.read()
    msg = json.loads(content)
    print(msg)
 
# 你的扣扣号
扣扣 = msg['扣扣']
# 浏览器打开扣扣空间,按F12,找到g_tk
g_tk = msg['g_tk']
# 要删除的对方的备注或昵称(ta在你空间所显示的名称)
targetname = msg['name'].split(',')
# 浏览器打开扣扣空间,按F12,找到cookie
cookie = msg['cookie']
# 1:删说说的评论;2:删留言板留言;3:1+2
mode = msg['mode']
 
print('@'*60)
print('>> 你的扣扣:', 扣扣)
print('>> 对方名称:', targetname)
print('>> 模式:', mode)
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.扣zone.扣扣.com/proxy/domain/taotao.扣扣.com/cgi-bin/emotion_cgi_msglist_v6?uin={0}&inCharset=utf-8&outCharset=utf-8&hostUin={0}&#172;ice=0&sort=0&pos={1}&num=20&cgi_host=https%3A%2F%2Fuser.扣zone.扣扣.com%2Fproxy%2Fdomain%2Ftaotao.扣扣.com%2Fcgi-bin%2Femotion_cgi_msglist_v6&code_version=1&format=json&need_private_comment=1&g_tk={2}'.format(扣扣, pos, g_tk)
        pos += 20
        html = re扣uests.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 = 扣扣+'_' + 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.扣zone.扣扣.com/proxy/domain/taotao.扣zone.扣扣.com/cgi-bin/emotion_cgi_delcomment_ugc?g_tk={0}'.format(g_tk)
    data={
        'uin': 扣扣,
        'hostUin': 扣扣,
        'topicId': topicId,
        'commentId': commentId,
        'inCharset':'',
        'outCharset':'',
        'ref':'',
        'hostuin': 扣扣,
        'code_version': '1',
        'format': 'fs',
        '扣zreferrer': 'https://user.扣zone.扣扣.com/proxy/domain/扣zs.扣扣.com/扣zone/app/mood_v6/html/index.html#mood&g_iframeUser=1&g_iframedescend=1&uin={0}&pfid=2&扣z_ver=8&appcanvas=0&扣z_style=31&#182;ms=&entertime=1588985689146&canvastype=&cdn_use_https=1'.format(扣扣)
    }
    html = re扣uests.post(url, headers=headers, data=data)
    time.sleep(1)
    html = re扣uests.post(url, headers=headers, data=data)
    if '对不起,原文已经被删除,无法查看' in html.text:
        print('原文已经被删除')
 
def get_msgboard():
    start = 0
    total = 10
    delcnt = 0
    delmsg = []
    while start<total:
        print('#' * 60)
        print(">> 当前位置:", start)
        url = 'https://user.扣zone.扣扣.com/proxy/domain/m.扣zone.扣扣.com/cgi-bin/new/get_msgb?uin={0}&hostUin={0}&num=10&start={1}&hostword=0&essence=1&r=0.2554088508533668&iNotice=0&inCharset=utf-8&outCharset=utf-8&format=json&ref=扣zone&g_tk={2}'.format(扣扣, start, g_tk)
        start += 10
        html = re扣uests.get(url, headers=headers).json()
        data = html['data']
        total = data['total']
        print('>> 总共条数:', total)
        commentList = data['commentList']
        for item in commentList:
            id = item['id']
            nickname = item['nickname']
            uin = item['uin']
            ubbContent = item['ubbContent']
            pubtime = item['pubtime']
            print(">> 留言: ({}){}\t{}".format(pubtime, nickname, ubbContent))
            if nickname in targetname:
                print(">> 删除本条留言")
                del_msgboard(id,uin)
                delcnt += 1
                delmsg.append(ubbContent)
        time.sleep(1)
    print('*' * 60)
    print('共删除条数:', delcnt)
    print('共删除内容:', delmsg)
    print('*' * 60)
 
 
def del_msgboard(target扣扣,uin):
    url = 'https://h5.扣zone.扣扣.com/proxy/domain/m.扣zone.扣扣.com/cgi-bin/new/del_msgb?g_tk={}'.format(g_tk)
    data={
        'hostUin': 扣扣,
        'idList': uin,
        'uinList': target扣扣,
        'format': 'fs',
        'iNotice': '1',
        'inCharset': 'utf-8',
        'outCharset': 'utf-8',
        'ref': '扣zone',
        'json': '1',
        'g_tk': g_tk,
        '扣zreferrer': 'https://user.扣zone.扣扣.com/proxy/domain/扣zs.扣扣.com/扣zone/msgboard/msgbcanvas.html#page=1'
    }
    html = re扣uests.post(url, headers=headers, data=data)
    time.sleep(1)
    html = re扣uests.post(url, headers=headers, data=data)
    if '留言不存在或已被删除' in html.text:
        print('留言不存在或已被删除')
 
try:
    if mode == '1':
        getcomment()
    elif mode == '2':
        get_msgboard()
    elif mode == '3':
        getcomment()
        get_msgboard()
except Exception as e:
    print(e)
input(">> 任意键退出...")
 
get_msgboard()

本站说明老表资源网:lbzyw.xyz 每天更新优质技术教程,资源,软件,活动,资讯!

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途, 否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内 ,从您的电脑或手机中彻底删除上述内容。

1、如果您喜欢该程序,请支持正版,购买注册,得到更好的正版服务。
2、本网站可能提供第三方网站的链接,我们不负责维护这些网站。我们不对这些网站的内容负责任。
3、提供这些网站的链接并不意味我们对这些网站或它们的内容的认可或支持。 本站不对这些链接网站作出任何陈述或保证,也不对它们负任何责任。
4、如有侵权请邮件与我们联系处理2658014622@qq.com 敬请谅解!

发表评论:

本站资源来自互联网收集,仅供用于学习和交流,我们尊重任何软件和教程作者的版权,请遵循相关法律法规,本站一切资源不代表本站立场

侵权删帖/违法举报/商务合作/投稿等事物联系QQ1010569847微信:vip12662
sitemap ★★版权声明★★ -当前在线[449]