Twitter API:谁取消了我的关注? [英] Twitter API: Who unfollowed from me?

查看:27
本文介绍了Twitter API:谁取消了我的关注?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到取消关注我的人?

How to find who unfollowed me?

任何人都可以使用 Twitter API 拥有这样的 php 脚本.有必要将 Twitter 消息发送给那些取消订阅我的人.

Can anyone have such a php script using the Twitter API. It is necessary that the Twitter messages sent to those who unsubscribed from me.

注意:我知道已经有特殊服务,但我需要您的简单服务,该服务将输出到我取消订阅的用户的推文中.

Note: I know that already have special services, but I need your, simple service that would be output to a tweet from me unsubscribing users.

谢谢.

推荐答案

使用简单的 API 调用无法做到这一点,但您可以保存每个用户的关注者,并且每次检查时都从旧数组中减去新数组.

That is not possible with a simple API call but you can save each user's followers and every next time you check you subtract the new array from the old array.

基本上是这样的:

$array1 = get_old_followers_ids (); // ex. from db
$array2 = get("followers/ids.json?screen_name=me");
$users = array_diff($array1, $array2);
$users = get ("users/lookup.json?user_id=" . implode(',', $users));

其中 get 将是您的 API 调用函数.唯一的方法是轮询数据.

where get would be your API calling function. The only way to do this is to poll the data.

请注意,示例脚本有其局限性.例如,如果自上次保存值 $array1 以来有超过 100 个用户取消关注您,则只会返回 100 个用户.

Note that the example script has it's limitations. For example if more than 100 users have unfollowed you since the the last time you saved values $array1, only 100 users will be returned.

这篇关于Twitter API:谁取消了我的关注?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆