【问题标题】:searching for tweets from multiple users with api 1.1使用 api 1.1 搜索来自多个用户的推文
【发布时间】:2013-06-18 02:26:13
【问题描述】:

自从我升级到 api 1.1 后,我就无法搜索来自多个用户的推文。例如,这个搜索-https://api.twitter.com/1.1/search/tweets.json?q=from:commute_by_bike OR from:BikeLeague OR from:peopleforbikes OR from:bikesbelong &count=20 返回零推文。这以前适用于 1.0 api。如果我只搜索其中一个用户,我会得到正确的结果,因此我知道身份验证正在工作。有什么建议?谢谢。

【问题讨论】:

    标签: ios api twitter


    【解决方案1】:

    我已经测试了您在上面发布的查询并使用以下 curl 命令(我从 Twitter 的 OAuth 工具中获得),我得到了几个推文结果。您的实际查询确实有效,可能只是某处的格式存在问题。使用 OAuth 工具重试查询以解决任何格式问题,然后编辑您的查询。

    curl --get 'https://api.twitter.com/1.1/search/tweets.json' \
    --data 'count=20&q=from%3Acommute_by_bike+OR+from%3ABikeLeague+OR+from%3Apeopleforbikes+OR+from%3Abikesbelong+' \
    --header 'Authorization: OAuth oauth_consumer_key="XXXXXXXX", oauth_nonce="XXXXXXXX", oauth_signature="XXXXXXXX", oauth_signature_method="XXXXXXX", oauth_timestamp="XXXXXXXXX", oauth_token="XXXXXXXX", oauth_version="1.0"' --verbose  
    

    【讨论】:

      【解决方案2】:

      使用新的 1.1 api,我正在搜索带有以下代码行的主题标签:

      [NSString stringWithFormat:@"https://api.twitter.com/1.1/search/tweets.json?q=%%23%@&result_type=mixed", hashtag]
      

      其中 hashtag 是一个 NSString,不包含 #。您需要为此进行身份验证,但您提到身份验证有效。祝你好运!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-09-05
        • 2016-07-03
        • 2013-06-06
        • 2013-06-09
        • 1970-01-01
        • 2016-12-19
        • 2020-10-05
        • 1970-01-01
        相关资源
        最近更新 更多