2

Twitter では、lang 演算子を使用して、特定の言語から取得するツイートを検索できます。たとえば、次の検索では、英語のツイートのみが返されます。

https://twitter.com/search?q=lang:en

特にtwitter4jを使用して、twitter APIを使用してこれを達成する方法はありますか? 検索用の言語属性があることは知っていますが、検索を行うには少なくとも 1 つのキーワードが必要です。キーワード クエリを指定せずに特定の言語で検索したいと考えています。Java ドライバーで次のコマンドを実行すると、次のエラーが返されます。

Query searchQuery = new Query() //
                        .count(resultsPerPage) //
                        .since(since)//
                        .lang("en");

400:The request was invalid. An accompanying error message will explain why. This is the status code will be returned during version 1.0 rate limiting(https://dev.twitter.com/pages/rate-limiting). In API v1.1, a request without authentication is considered invalid and you will get this response.
message - Query parameters are missing
code - 25

乾杯

4

2 に答える 2

2

Twitter 検索で使用するのと同じものを渡す必要があります。クエリは次のようになります。

new Query("lang:en")
于 2013-02-06T12:37:29.680 に答える