Twitter 搜索 API returns 没有推文?

Twitter search API returns no tweets?

我正在使用 NodeJS 和一个名为 oauth 的 npm 包来与 Twitter 的搜索进行通信 API。然而,出于某种原因,twitter 返回给我一个空的状态数组,没有任何错误......更令人困惑的是,使用像 Postman 这样的工具具有完全相同的请求和键 returns 列表推文?这没有道理!这是我的要求:

URL: https://api.twitter.com/1.1/search/tweets.json?count=100&q=hello&since_id=577103514154893312&max_id=577103544903462913

这是我的代码:

    var twitter_auth = new OAuth(
        "https://api.twitter.com/oauth/request_token",
        "https://api.twitter.com/oauth/access_token",
        config.consumer_key,
        config.consumer_secret,
        "1.0A",
        null,
        "HMAC-SHA1"
    );

    var request = twitter_auth.get(
        "https://api.twitter.com/1.1/search/tweets.json" + url,
        config.access_token,
        config.access_token_secret
    );

    var chunk = "", message = "", that = this;
    request.on("response", function(response){
        response.setEncoding("utf8");
        response.on("data", function(data){
            chunk += data;

            try {
                message = JSON.parse(chunk);
            } catch(e) {
                return;
            }

            console.log(message);

            if(message.statuses)
            {
                for(var i = 0; i < message.statuses.length; i++)
                {
                    var tweet = message.statuses[i];
                    that.termData[term.name].push(tweet);
                }
                if(message.search_metadata.next_results)
                {
                    that.openRequests.push(that.createNewSearch(message.search_metadata.next_results, term));
                }
                else
                {
                    that.termCompleted(term);
                }
            }
            else if(message)
            {
                console.log("Response does not appear to be valid.");
            }
        });
        response.on("end", function(){
            console.log("Search API End");
        });
        response.on("error", function(err){
            console.log("Search API Error", err);
        });
    });

    request.end();

console.log(message) 正在返回:

{
    statuses: [],
    search_metadata: {
        completed_in: 0.007,
        max_id: 577103544903462900,
        max_id_str: '577103544903462913',
        query: 'hello',
        refresh_url: '?since_id=577103544903462913&q=hello&include_entities=1',
        count: 100,
        since_id: 577103514154893300,
        since_id_str: '577103514154893312'
    }
}

知道发生了什么事吗?为什么状态数组在我的代码中是空的,但在 Postman 中却充满了推文?

twittercommunity.com 中描述了此问题。

用户 rchoi(Twitter 员工)的相应回答:

“关于网络与 API 搜索,我们知道目前这两个 return 不同的结果。我们对网络搜索进行了升级。没有时间表 将对我们系统的其他部分进行更改。"

尝试使用 https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline https://dev.twitter.com/rest/reference/get/statuses/user_timeline 如果使用 api 搜索功能得到空结果。

请关注这个link https://twittercommunity.com/t/search-tweets-api-returned-empty-statuses-result-for-some-queries/12257/6