Twitter REST API, Streaming API

 
 
 
 
 
用Twitter自己的话来说:
 

REST API

The REST API provides simple interfaces for most Twitter functionality.

the Streaming APIs

The Streaming API is a family of powerful real-time APIs for Tweets and other social events.

       显而易见,REST API看上去没Streaming API这么高级。这也是有历史原因的。之前Twitter没有自己的搜索功能,大家用着都挺不方便。而一家叫做Summarize. Inc的,只有五名工程师的小公司,正好做了这个功能满足客户需求。Twitter对其十分很欣赏,用Twitter创始人之一Biz Stone的话来说,就是“We had already fallen in love with both"。于是,2008年7月,Twitter对Summarize进行了收购,并把该功能重新包装为“Twitter Search”。这家公司开发的API,就是REST API。

       但除此之外,Twitter作为自主研发的一套系统,不能没有自己的家伙,2010年7月,Twitter的亲儿子,Streaming API诞生。亲儿子嘛,高级一些也是很合理的。

       Twitter承诺将整合二者,但目前看来这项工作还在漫漫无期的进行当中,REST API甚至还推出了1.1的新版本。

 

REST API

可用于查询,修改某用户账户。查询无需用户权限,修改需要用户权限。权限由OAuth提供。

非实时,对数据量等方面有较严格的限制。

传统的Web信息交流模式,发送Request, 返回数据。

返回大约最近一周的数据。

Streaming API

根据搜索条件,用户名,实时返回tweets和用户信息,无需用户权限。但必须通过basic或OAuth登录你自己的Twitter账号才能使用Streaming。

实时,限制较为宽松。

需与Twitter Server建立长期Connection(几个月甚至数年!只要你还需要Twitter数据!),得用一个长期的系统进程去维护它!

只返回Connection建立之后的数据,不返回历史。

 

还有很多不同,详情参见

http://140dev.com/twitter-api-programming-tutorials/aggregating-tweets-search-api-vs-streaming-api/

 

参考:

http://stackoverflow.com/questions/5400760/twitter-api-rest-and-streaming-whats-the-difference
https://dev.twitter.com/docs
https://dev.twitter.com/docs/history-rest-search-api
http://tech.qq.com/a/20100321/000033_2.htm
http://www.techweb.com.cn/news/2010-07-29/650599.shtml
https://blog.twitter.com/2008/finding-perfect-match
http://140dev.com/twitter-api-programming-tutorials/aggregating-tweets-search-api-vs-streaming-api/
原文地址:https://www.cnblogs.com/panpanwelcome/p/9798373.html