5

是否可以通过API删除两个FB用户之间的好友关系?我认为不是,但是(如果不是)是否有可能至少调出一个对话框,让用户请求取消好友,类似于好友对话框(http://developers.facebook.com/docs /reference/dialogs/friends/) 让用户发送好友邀请?

4

3 回答 3

13

通过 API 是不可能的。Facebook 就像黑手党——你可以进去。但没有出路。

类似于这个问题: 任何方法可以使用 Facebook 的 PHP SDK 或 API 取消好友或删除好友?

此外,Facebook 应用程序要求人们解除好友关系也违反了服务条款。有一个 BurgerKing prootional 应用程序在病毒式传播后与该应用程序发生了冲突。 http://www.insidefacebook.com/2009/01/14/whopper-sacrifice-shut-down-by-facebook/

让朋友在自己的时间取消朋友。

于 2011-11-10T23:47:51.947 回答
5

你可以用浏览器脚本来做到这一点: Deleting All Facebookfriend programmatically using fb graph api

此页面中的脚本已过时,这是一个有效的脚本:

$.ajax({
  url: "https://graph.facebook.com/me/friends?access_token=ACCESS_TOKEN", // get this at https://developers.facebook.com/tools/explorer take the Friends link and replace it.
  success: function(data) {
        jQuery.each(data.data, function() {
            $.ajax({
                url: "https://m.facebook.com/a/removefriend.php",
                data: "friend_id="+this.id+"&fb_dtsg=AQC4AoV0&unref=profile_gear&confirm=Confirmer",
                async: false,
                type: "post"
                }
            })
        });
  },
  dataType: "json"
});
于 2014-01-26T18:23:31.943 回答
0

这是 2021 年的工作代码,我尝试过的其他方法已过时。

  1. 转到https://m.facebook.com/friends/center/friends并打开浏览器控制台。
  2. 在浏览器控制台中执行来自https://code.jquery.com/jquery-3.6.0.min.js的 jquery-min 定义代码。
  3. 从浏览器控制台运行以下代码。

// from https://m.facebook.com/friends/center/friends  
// first copy paste: https://code.jquery.com/jquery-3.6.0.min.js


let ok = this.document 
let firstrec = ok.firstChild.nextSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.nextElementSibling.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.firstElementChild nextrec = firstrec

// simulate click function async function clickf(div, entry) {
    if (entry == null) {
        await $(div).click()
        return await $(div).click()
    }
    if (entry == "0") {
        console.log("ehhe")
        await $(div)[0].click()browse
        return await $(div)[0].click()
    } }


function* removefb() {
    while (true) {
        nextclick = nextrec.firstElementChild.nextElementSibling.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.nextElementSibling.nextElementSibling.firstElementChild
        nextreccopy = nextrec
        nextrec = nextrec.nextSibling
        if (nextrec == null) {
            nextrec = nextreccopy
            nextrec = nextrec.parentElement.nextElementSibling.firstElementChild
        }
        clickf(nextclick)

        remover = nextclick.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.firstElementChild.nextElementSibling
        clickf(remover, 0)
        yield
    } }

function greet() {
    removefb().next() }

setInterval(greet, 1000);

https://github.com/danass/remove-fb-friends/

此代码可帮助您批量删除所有 facebook 朋友。

于 2021-11-23T14:49:31.860 回答