检索给定主题标签的最多转发推文 [英] Retrieve most retweeted tweets for a given hashtag
问题描述
我想检索给定主题标签的推文,并将它们从转发最多的推文到转发较少的推文进行排序.
I'd like to retrieve the tweets for given a hashtag and sort them from the most retweeted to the less retweeted.
我发现最接近的是使用搜索调用并使用类型标签:例如:http://search.twitter.com/search.json?q=TheHashTagHere&result_type=popular
The closest thing I've found is using the search call and use the type tag: E.g.: http://search.twitter.com/search.json?q=TheHashTagHere&result_type=popular
但是,我不确定流行"选项的工作原理.
However, I'm not sure on how "popular" option works.
例如,如果它找到 100 条带有该标签的推文,我相信它应该显示 X 条转发最多的推文,如果这些推文都没有被转发,那么它应该随机显示其中的 X 条(或以其他方式排序,例如最近的).
For instance, if it finds 100 tweets with that hashtag I believe it should show the X most retweeted tweets, and if none of those tweets have been retweeted then it should show X of them randomly (or sorted in some other way like the most recent).
不幸的是,如果遵循某种未知规则来确定什么是流行的,什么是不受欢迎的,甚至带有数千条推文的主题标签可能只会返回一两个结果.
Unfortunately, if follows some kind of unknown rule to identify what's popular and what not and even hashtags with thousands of tweets might return only one or two results.
我希望我说清楚了.提前致谢:)
I hope I made myself clear. Thanks in advance :)
PS:我会使用 PHP,但我认为这不会影响问题吗?
PS: I'll use PHP but I think that shouldn't affect the question?
推荐答案
结果有时会包含一个元数据中的 result_type 字段具有最近"的值或者流行".热门结果推导出来通过 Twitter 计算的算法,并且最多 3 将出现在默认Search API 的混合模式下经营.热门结果在元数据中包含另一个节点称为recent_retweets.这个领域表示推文的转发次数有过.
Results will sometimes contain a result_type field into the metadata with a value of either "recent" or "popular". Popular results are derived by an algorithm that Twitter computes, and up to 3 will appear in the default mixed mode that the Search API operates under. Popular results include another node in the metadata called recent_retweets. This field indicates how many retweets the Tweet has had.
来源(重点是我的)
只需使用 result_type=popular
并检查 recent_retweets
节点以了解它的流行程度.result_type=popular
将在即将发布的版本中成为默认值,因此如果省略此参数,请注意.
Just call with result_type=popular
and check the recent_retweets
node to see how popular it is. result_type=popular
will become the default in an upcome release so beware if you omit this parameter.
热门推文的结果不按时间顺序排列.*
Results with popular tweets aren't ordered chronologically. *
如果您希望始终显示结果,请使用 result_type=mixed
:他们将在元数据"中包含 result_type
值最近"的部分,流行结果将具有流行".关于 result_types 的一个小参考:
If you would like to always have results to show, use result_type=mixed
: they will have the result_type
in the "metadata" section with a value of "recent", and popular results will have "popular". A small reference about result_types:
混合:在响应中包含热门和实时结果.
mixed: Include both popular and real time results in the response.
recent:在响应中只返回最近的结果
recent: return only the most recent results in the response
popular:仅返回响应中最受欢迎的结果.
popular: return only the most popular results in the response.
如果搜索查询有任何热门结果,这些结果将在顶部返回,即使它们比其他结果早.*
If a search query has any popular results, those will be returned at the top, even if they are older than the other results. *
这篇关于检索给定主题标签的最多转发推文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!