查询中带有印地文字符的Twitter搜索API返回403错误

时间:2016-05-31 11:56:37

标签: twitter twitter4j hindi twitter-search

使用此查询时,我从搜索API收到403错误:

  

"सार्वजनिकस्वास्थ्यजॉन्सहॉपकिन्सविद्वालय"或者"एमएएनए   पौष्टिकसहायताउत्पादनिगम"或者"मेडिसिन्ससैंसफ्रंटियर्स"

我从Twitter获得的错误api是:

  

{exceptionCode = [8e13056f-6071abbc],statusCode = 403,message =缺少或   无效的url参数。,code = 195,retryAfter = -1,   rateLimitStatus = RateLimitStatusJSONImpl {remaining = 447,limit = 450,   resetTimeInSeconds = 1464249586,secondsUntilReset = 695},version = 4.0.1}

这很奇怪,因为如果我从原始查询中删除任何元素,它就会起作用。

我发送的请求是: https://api.twitter.com/1.1/search/tweets.json?q=%22%E0%A4%B8%E0%A4%BE%E0%A4%B0%E0%A5%8D%E0%A4%B5%E0%A4%9C%E0%A4%A8%E0%A4%BF%E0%A4%95%20%E0%A4%B8%E0%A5%8D%E0%A4%B5%E0%A4%BE%E0%A4%B8%E0%A5%8D%E0%A4%A5%E0%A5%8D%E0%A4%AF%20%E0%A4%9C%E0%A5%89%E0%A4%A8%E0%A5%8D%E0%A4%B8%20%E0%A4%B9%E0%A5%89%E0%A4%AA%E0%A4%95%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%B8%20%E0%A4%B5%E0%A4%BF%E0%A4%B6%E0%A5%8D%E0%A4%B5%E0%A4%B5%E0%A4%BF%E0%A4%A6%E0%A5%8D%E0%A4%AF%E0%A4%BE%E0%A4%B2%E0%A4%AF%22%20OR%20%22%E0%A4%8F%E0%A4%AE%E0%A4%8F%20%E0%A4%8F%E0%A4%A8%20%E0%A4%8F%20%E0%A4%AA%E0%A5%8C%E0%A4%B7%E0%A5%8D%E0%A4%9F%E0%A4%BF%E0%A4%95%20%E0%A4%B8%E0%A4%B9%E0%A4%BE%E0%A4%AF%E0%A4%A4%E0%A4%BE%20%E0%A4%89%E0%A4%A4%E0%A5%8D%E0%A4%AA%E0%A4%BE%E0%A4%A6%20%E0%A4%A8%E0%A4%BF%E0%A4%97%E0%A4%AE%22%20OR%20%22%E0%A4%AE%E0%A5%87%E0%A4%A1%E0%A4%BF%E0%A4%B8%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%B8%20%E0%A4%B8%E0%A5%88%E0%A4%82%E0%A4%B8%20%E0%A4%AB%E0%A5%8D%E0%A4%B0%E0%A4%82%E0%A4%9F%E0%A4%BF%E0%A4%AF%E0%A4%B0%E0%A5%8D%E0%A4%B8%22&count=100&since=2016-05-23&with_twitter_user_id=true&include_entities=true

你知道出了什么问题吗?

1 个答案:

答案 0 :(得分:0)

您只需达到查询限制,一旦超过最大长度,即使是简单的重复A OR B查询也可能会出现类似的失败。

https://dev.twitter.com/rest/reference/get/search/tweets

  

q:最多500个字符的UTF-8,URL编码搜索查询,   包括运营商。查询可能另外受限于   复杂性。

由于您需要OR,因此您应该查询3次并将结果合并到您的代码中。