tap
Back

instagram/unfollow

instagramRead-write

取消关注用户 (unfollow user)

www.instagram.com
Last 7 days
0
Last 30 days
0
All time
0
instagram/unfollow.js
/* @meta
{
  "name": "instagram/unfollow",
  "description": "取消关注用户 (unfollow user)",
  "domain": "www.instagram.com",
  "args": {
    "user_id": {"required": true, "description": "用户 pk ID"}
  },
  "capabilities": ["network"],
  "readOnly": false,
  "example": "bb-browser site instagram/unfollow 22326145"
}
*/

async function(args) {
  if (!args.user_id) return {error: 'Missing argument: user_id', hint: '请提供用户 pk ID'};

  var csrfMatch = document.cookie.match(/csrftoken=([^;]+)/);
  if (!csrfMatch) return {error: 'Not logged in', hint: '请先登录 Instagram', action: 'bb-browser open https://www.instagram.com/accounts/login/'};

  var resp = await fetch('/api/v1/friendships/destroy/' + args.user_id + '/', {
    method: 'POST',
    credentials: 'include',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'X-CSRFToken': csrfMatch[1],
      'X-IG-App-ID': '936619743392459',
      'X-Requested-With': 'XMLHttpRequest'
    },
    body: ''
  });

  if (!resp.ok) return {error: 'HTTP ' + resp.status, hint: '取消关注失败'};
  var d = await resp.json();
  return {user_id: args.user_id, status: d.status, friendship_status: d.friendship_status || null};
}
Updated May 23, 2026Created May 23, 2026SHA-256: 4ed7c7c21464