亲自测试用
具体操作如下:
对应的 1 2 如下,进入这个界面是按F12 就可以看到
最后画横线的位置 替换自己的id 对应的就是 3
具体代码如下
//向删除接口发起请求,删除对应节点
function del_weibo(id) {
var myHeaders = new Headers();
myHeaders.append("Cookie", "你的cookie");
myHeaders.append("Referer", "https://weibo.com/");
myHeaders.append("Sec-Fetch-Mode", "cors");
myHeaders.append("Accept", "application/json, text/plain, */*");
myHeaders.append("Origin", "https://weibo.com");
myHeaders.append("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36");
myHeaders.append("Client-Version", "v2.40.83");
myHeaders.append("X-Xsrf-Token", "BGiEAX1u7-OXa3jLt3eUT3yz");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"id": id
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://weibo.com/ajax/statuses/destroy", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
}
// 查找到所有微博节点并根据其name属性删除(name为唯一标识)
function del_page() {
var myHeaders = new Headers();
myHeaders.append("Cookie", "你的cookie");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://weibo.com/ajax/statuses/mymblog?uid=你的id数字&page=1&feature=0", requestOptions)
.then(response => response.text())
.then(result => {
let list = JSON.parse(result).data.list;
list.forEach(item => {
del_weibo(item.id)
})
})
.catch(error => console.log('error', error));
}
// 主函数
function del_all_weibo() {
del_page();
}
// del_all_weibo()
window.setInterval(del_all_weibo, 5000);