You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用instagram-private-api添加密友遇9999上限报错求助

Instagram密友列表添加超9999人触发400错误的解决方案

问题核心

你遇到的max besties exceeded错误,是因为Instagram私有API的/api/v1/friendships/set_besties/接口存在9999人的隐藏总上限——这个限制未在官方文档中公开,但属于私有API层面的硬限制,和单次提交的批次大小无关,哪怕单次只加1人,只要密友列表总人数超过9999就会触发400错误。

解决方案

1. 优化代码的错误处理逻辑

在你的addToCloseFriends函数中,针对该特定错误做针对性处理,避免流程意外中断,同时明确提示上限:

async function addToCloseFriends(ig: IgApiClient, followerIds: string[], batchSize: number, requestDelay: number, batchDelay: number) {
    let totalAdded = 0;
    console.log(`开始添加${followerIds.length}名关注者到密友列表...`);
    for (let i = 0; i < followerIds.length; i += batchSize) {
        const batch = followerIds.slice(i, i + batchSize);
        try {
            await ig.friendship.setBesties({ add: batch, remove: [] });
            totalAdded += batch.length;
            console.log(`已添加第${Math.floor(i / batchSize) + 1}批,累计添加${totalAdded}人`);
            await new Promise(resolve => setTimeout(resolve, requestDelay))
        } catch (error) {
            if (error instanceof IgNotFoundError) {
                console.error('API端点不存在:', error.message);
            } else if (error instanceof IgResponseError && error.message.includes('max besties exceeded')) {
                console.error(`⚠️ 已达密友列表隐藏上限(9999人),最终累计添加${totalAdded}人`);
                break; // 触发上限后停止流程
            } else {
                console.error('添加密友时出错:', error);
            }
            break;
        }
    
        await new Promise(resolve => setTimeout(resolve, batchDelay));
    }
    console.log('密友添加流程结束');
}

2. 替代方案:用粉丝群组替代密友列表

如果需要定向分享给超过9999的用户,建议使用Instagram的粉丝群组功能:

  • 群组支持的成员数量远高于密友列表上限
  • 可创建多个群组分类管理不同用户群体
  • 同样支持定向发布内容到指定群组

3. 模拟手动浏览器操作(非私有API方案)

若坚持使用密友列表,可通过Selenium或Puppeteer模拟手动添加操作——Web端手动添加的接口可能没有9999的限制,但需注意:

  • 频繁自动化操作可能触发账号风控,需增加随机延迟、模拟人类操作轨迹
  • 维护成本高于直接使用私有API

关键说明

  • 目前没有公开方法可以绕过私有API的9999密友上限,这是Instagram的后端限制
  • 你提到的“有人添加超5万名密友”大概率是旧版本Instagram的情况,或是使用了非公开的特殊接口,当前主流私有API均受此限制

内容的提问来源于stack exchange,提问作者Hamza

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 11:03:21