前面说的是拉黑,有时到不了那一步,只想送走,移除某些uid对自己的关注。用F12观察一次实际移除关注操作,看到

curl 'https://weibo.com/aj/f/remove?ajwvr=6' \
...
  -H 'x-requested-with: XMLHttpRequest' \
  --data-raw 'uid=7160973228&f=1'

切至weibo.com页面,测试移除关注脚本

var uidlist = ['7160973228'];
var http    = new XMLHttpRequest();
for ( var i = 0; i < uidlist.length; i++ )
{
    var uid = uidlist[i];
    var rnd = Math.floor( Math.random() * 1e4 + 1.5788995e12 );
    var url = 'https://weibo.com/aj/f/remove?ajwvr=6';
    http.open( 'POST', url, false );
    http.setRequestHeader( 'Content-type', 'application/x-www-form-urlencoded' );
    http.send( 'uid=' + uid + '&f=1&__rnd' + rnd );
    if ( http.status === 200 )
    {
        var resp    = JSON.parse( http.responseText );
        if ( resp.code != 100000 )
        {
            console.error( '失败: ' + uid );
        }
    }
}

对某条评论的所有点赞uid进行批量移除,每移除10个uid休眠1秒

function sleep ( ms )
{
    return new Promise( resolve => setTimeout( resolve, ms ) );
}

async function remove ( cid, group, interval )
{
    var http_0  = new XMLHttpRequest();
    var http_1  = new XMLHttpRequest();
    var pagenum = 1;
    var count   = 0;
    while ( 1 )
    {
        var url = 'https://weibo.com/aj/like/object/big?ajwvr=6&page=' + pagenum + '&object_id=' + cid + '&object_type=comment';
        http_0.open( 'GET', url, false );
        http_0.send( null );
        if ( http_0.status === 200 )
        {
            var resp    = JSON.parse( http_0.responseText );
            var temp    = resp.data.html.match( /(?:uid=\")(\d+)(?:\")/g );
            if ( temp )
            {
                for ( var i = 0; i < temp.length; i++ )
                {
                    var uid = temp[i].match( /\d+/i )[0]
                    // console.log( uid );
                    var rnd = Math.floor( Math.random() * 1e4 + 1.5788995e12 );
                    http_1.open( 'POST', 'https://weibo.com/aj/f/remove?ajwvr=6', false );
                    http_1.setRequestHeader( 'Content-type', 'application/x-www-form-urlencoded' );
                    http_1.send( 'uid=' + uid + '&f=1&__rnd' + rnd );
                    count++;
                    if ( count % group === 0 )
                    {
                        console.log( uid );
                        await sleep( interval * 1000 );
                        count   = 0;
                    }
                }
            }
            if ( resp.data.page.pagenum == resp.data.page.totalpage )
            {
                break;
            }
        }
        pagenum++;
    }
}

remove( 4802692784066365, 10, 1 );

批量拉黑有134位网友友情参与了实际测试,批量移除未经大规模实测,仅为PoC。

2022-08-16 15:59 tk

如下脚本获取给某条微博(不是评论)点赞的最新200个uid

/*
 * https://weibo.com/1909377960/M1aPZCtuR?type=like
 *
 * F12看到
 *
 * https://weibo.com/aj/v6/like/likelist?ajwvr=6&mid=4802799919169853&issingle=1&type=0&_t=0&__rnd=1660637649336
 * https://weibo.com/aj/v6/like/likelist?ajwvr=6&mid=4802799919169853&type=0&page=2&issingle=1&max_id=4803120310518797&_t=0&__rnd=1660637604469
 */
var mid     = 4802799919169853;
/*
 * 0    常规点赞
 * 1    竖大拇指
 * 2    微笑
 * 3    悲伤
 * 4    惊讶
 * 5    愤怒
 */
var type    = 0;
var url     = 'https://weibo.com/aj/v6/like/likelist?ajwvr=6&mid=' + mid + '&issingle=1&type=' + type + '&_t=0';
var http    = new XMLHttpRequest();
var uidlist = [];
while ( 1 )
{
    var rnd     = Math.floor( Math.random() * 1e4 + 1.5788995e12 );
    url         = url + '&__rnd' + rnd
    http.open( 'GET', url, false );
    http.send( null );
    if ( http.status != 200 )
    {
        break;
    }
    var resp    = JSON.parse( http.responseText );
    var temp    = resp.data.html.match( /\"id=\d{10}\"/g );
    // console.log( temp )
    if ( !temp )
    {
        break;
    }
    for ( var i = 0; i < temp.length; i++ )
    {
        uidlist.push( temp[i].match( /\d{10}/i )[0] );
    }
    console.log( uidlist.length + '\n' );
    temp        = resp.data.html.match( /mid=\d+\&type=\d+\&page=\d+\&issingle=\d+\&max_id=\d+/ );
    if ( !temp )
    {
        break;
    }
    url         = 'https://weibo.com/aj/v6/like/likelist?ajwvr=6&' + temp[0] + '&_t=0';
}
console.log( uidlist );