是否选择搜索或公共地理鸣叫的Twitter的流API? [英] Whether to choose Search or Streaming API of Twitter for public geo-tweets?

查看:179
本文介绍了是否选择搜索或公共地理鸣叫的Twitter的流API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个Android应用程序,将来自Twitter的公共时间轴基于用户(电流/指定)的位置获取地理标记的鸣叫。我将有一个刷新按钮,更推特(30最大的自定义尺寸),如果将提供特定时间获取。

I want to develop an Android app that will fetch geo-tagged tweets from Twitter public timeline based on user's (current/specified) location. I will have a refresh button and more tweets (custom size of 30 max) will be fetched if available in that particular time.

那么,哪API是适合这种情况?搜索API或串流API。

So which API is suitable for this case? Search API or Streaming API.

我将使用Twitter4J库。

I will use Twitter4J library.

推荐答案

流API 要求您保持连接活跃。这需要一个服务器进程具有无限循环,以获得最新的鸣叫。

The streaming API requires that you keep the connection active. This requires a server process with an infinite loop, to get the latest tweets.

优势

1)在滞后检索结果:
用这种方法递送鸣叫基本上实时的,与第二的滞后或两个在时间之间最鸣叫被发布,它是从API接收

1)Lag in retrieving results: Tweets delivered with this method are basically real-time, with a lag of a second or two at most between the time the tweet is posted and it is received from the API

2)不速率限制。

搜索API 是两种方法的更容易实现,但它是速率的限制
。每个请求将返回多达100个微博,你可以使用页面参数要求最多15页,让您的1500鸣叫理论上的最大单个查询。

The search API is the easier of the two methods to implement but it is rate limited .Each request will return up to 100 tweets, and you can use a page parameter to request up to 15 pages, giving you a theoretical maximum of 1,500 tweets for a single query.

优势

1)寻找鸣叫过去:在默认情况下搜索API胜在这方面,由于流API不提供任何过去的鸣叫

1)Finding tweets in the past:The search API wins by default in this area, because the streaming API doesn’t deliver any past tweets

2)更容易实施

在你的情况下,实时微博,你可以去流API,如果你的请求数量是很高的。

In your case, for real time tweets, you can go for streaming API if your number of requests are high.

请访问<一个href=\"http://140dev.com/twitter-api-programming-tutorials/aggregating-tweets-search-api-vs-streaming-api/\"相对=nofollow>此链接了解更多详情。

这篇关于是否选择搜索或公共地理鸣叫的Twitter的流API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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