0

我正在尝试找到一种方法来向所有用户发送推文。JSON 代码将这些指示为“to_user”空值。例如下面的推文 edent 向所有人发送推文,因此 to_user=null。
我尝试了一些替代方案但没有成功:

http://search.twitter.com/search.json?q=to:null%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:0%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:%20from:edent&result_type=mixed

{
        "created_at": "Thu, 28 Jun 2012 06:55:58 +0000",
        "from_user": "edent",
        "from_user_id": 14054507,
        "from_user_id_str": "14054507",
        "from_user_name": "Terence Eden",
        "geo": null,
        "id": 218236278402068480,
        "id_str": "218236278402068480",
        "iso_language_code": "en",
        "metadata": {
            "result_type": "recent"
        },
        "profile_image_url": "http://a0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
        "profile_image_url_https": "https://si0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
        "source": "<a href="http://twitter.com/">web</a>",
        "text": "RT @straczynski: @edent Clearly the man was ahead of his time.",
        "to_user": null,
        "to_user_id": 0,
        "to_user_id_str": "0",
        "to_user_name": null,
        "in_reply_to_status_id": 218075066452287500,
        "in_reply_to_status_id_str": "218075066452287488"
    },
4

1 回答 1

4

如果您只是想从特定用户那里获取不属于任何人的推文,请使用/get/statuses/user_timeline REST API 端点而不是搜索 API。/get/statuses/user_timeline 有一个 exclude_replies 参数,应该可以满足您的需求。

搜索 API 无法排除回复。您唯一的选择是获取与您传递的任何其他参数匹配的推文,并在您的最后处理它们以删除任何文本以“@”开头的任何内容。

于 2012-07-04T22:19:47.490 回答