实时统计特定标签的推文数量。

huangapple go评论129阅读模式
英文:

count number of tweets for a specific hashtag in real time

问题

你可以使用Twitter的API来统计特定标签的推文数量。不过,为了使用API,你需要创建一个Twitter开发者账号,并在Twitter开发者网站上创建一个应用程序。这样你就可以获取API密钥和访问令牌,以便通过编程方式访问Twitter的数据。

至于避免使用PHP和选择使用Go或C++,这是完全可行的。你可以使用任何你熟悉的编程语言来编写代码,只要它支持HTTP请求和JSON解析即可。Twitter的API是基于RESTful架构的,所以你可以使用任何语言的HTTP库来发送请求并解析返回的JSON数据。

希望对你有所帮助!

英文:

how can you count the count number of tweets for a specific hashtag on twitter? is there a way to avoid php and creating twitter app on the twitter developer site?

i might want to use go or c++ instead of php.

Thanks,
Geri

答案1

得分: 4

为了实时计算推文数量,您需要使用Twitter的流式API,特别是statuses/filter端点。使用track参数和您感兴趣的标签,您将实时接收到匹配的推文。

要开始使用,您需要在https://apps.twitter.com/上为您的Twitter应用程序创建凭据,然后从您喜欢的编程语言中使用API。最快的方法是使用现有的库,它将为您处理身份验证和与Twitter API的连接。

如果您想使用Go语言,我强烈推荐@kurriktwittergo库,它支持流式API。对于其他语言,您可以查看Twitter Libraries页面。

英文:

In order to count Tweets in real-time, you will need to use the Twitter Streaming APIs, in particular the statuses/filter endpoint. Using the track parameter with the hashtag you are interested in, you will receive matching Tweets in real-time.

In order to get started, you will need to create credentials for your Twitter app on https://apps.twitter.com/, then consume the API from your favorite language. The fastest way is to use an existing library which will handle the authentication and the connection to the Twitter API for you.

If you want to use Go, I definitely recommend twittergo by @kurrik which supports the Streaming APIs. For other languages, you can take a look at this page on Twitter Libraries.

答案2

得分: 2

你也可以使用 tweepy,一个 Python API,来访问 Twitter 的 API。但首先,你需要获得 Twitter 流 API 的访问权限,为此你需要在 apps.twitter.com 上拥有一个账号。

英文:

You can also use tweepy a python API to access twitter APIS . But first you should have twitter streaming API access for that you should have an account at apps.twitter.com

答案3

得分: 1

你将始终需要在 Twitter 开发者门户网站 https://apps.twitter.com/ 上创建一个应用程序,因为这是你管理 API OAuth 密钥的地方。正如 Romain 所说,这里最好的选择是使用 Streaming API。

英文:

You will always need to create an app on the Twitter Developer portal https://apps.twitter.com/ as this is where you get to manage your API OAuth keys. As Romain says, the best option here would be to use the Streaming API.

huangapple
  • 本文由 发表于 2014年5月12日 01:11:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/23595540.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定