按语言搜索推特 [英] Search twitter by language

查看:42
本文介绍了按语言搜索推特的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Twitter 中,您可以使用 lang 运算符搜索从特定语言检索推文:例如,以下搜索将仅返回英文推文:

In twitter by using lang operator you can search for retrieving tweets from a particular language: For example, the following search will return tweets only in english:

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

有没有办法使用 twitter api 来实现这一点,尤其是使用 twitter4j.我知道有一个用于搜索的语言属性,但它也需要至少一个关键字来进行搜索,我想按特定语言进行搜索而不提供任何关键字查询.java驱动程序中的以下命令返回以下错误:

Is there a way to achieve this using twitter api, especially using twitter4j. I know there is a language attribute for search but it also requires at least one keyword to make a search, I would like to search by a particular language without giving any keyword query. The following command in java driver returns the following error:

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

干杯

推荐答案

您必须通过与您在 twitter 搜索中使用的相同的内容,您的查询将类似于:

You must pass the same do you use in the twitter search, your query will be like:

new Query("lang:en")

这篇关于按语言搜索推特的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆