批量删除新浪微博中的微博批量删除

很久没写博客了,因为一直都用云笔记,使用起来比较方便,但是这样一来分享的便少了许多。最近突然看起书来,所谓书非秀不能读,,所以想把读书笔记或者感想发到微博上去,11年申请的那个微博不忍直视,于是想把1500+多的微博批量删除掉。官方搜索到的那个“批量小管家”根本删不了几条,说是因为违反开放规则诸类,于是自己手动写一个脚本批量删除。

翻页获取微博源码,保存到文本文件1.txt中:

s = ''for i=1,2 dohtml = star.gethtml('?is_search=0&visible=0&is_tag=0&profile_ftype=1&page='..i..'#feedtop')if html~=nil and html~='' thens = s..htmlendend local file = io.open("1.txt","w+"); file:write(s);if s~=nil thenreturnend

从文本文件中解析微博id:require 'star'print(star.getluapath()..'1.txt')file = io.open(star.getluapath()..'1.txt','r')s = file:read('*all')io.close(file)t = {}result = 'ids = { 'count = 1for id in string.gfind(s,[[mid=(%d+)]]) do if t[id]==nil then t[id] = 1 result = result..'\&;'..id..'\&;,\n' endendfor id in string.gfind(s,[[mid=\&;(%d+)]]) do if t[id]==nil then t[id] = 1 result = result..'\&;'..id..'\&;,\n' endendresult = result..'}'star.copytoclipboard(result)生成的格式为:ids = { '3407583320911240','3407583195258111','3407581206852127','3407580665566639','3407562152369100','3407562097833138','3407561703409507','3407561615313063','3407561539802508','3407490148918060','3407487829060482','3407488814390112','3407489640679647',}然后循环POST请求,删除:HEADERS = [[Host: weibo.comConnection: keep-aliveContent-Length: 20Origin: X-Requested-With: XMLHttpRequestUser-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.15 Safari/537.36Content-Type: application/x-www-form-urlencodedAccept: */*Referer: <span style="font-family: 微软雅黑;">122342324234</span><span style="font-family: 微软雅黑;">/profile?topnav=1&wvr=6</span>Accept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.8,en;q=0.6Cookie: ]] for i=1,#ids do html = star.sendhttpdata('weibo.com','/aj/mblog/del?ajwvr=6',HEADERS,'mid='..ids[i],0,1) _,_,s = string.find(html, [["msg":"(.-)"]]) s = star.DecodeEscapeUsequence(s) if #s~= 0 then –msgbox(s) end end希望有心之人可以依此写一个自动化工具,我是懒狗一个~汪汪

和属于我们的风景。一起吃早餐,

批量删除新浪微博中的微博批量删除

相关文章:

你感兴趣的文章:

标签云: