简体   繁体   English

Twitter API JSON调用未获取最新的3条推文

[英]Twitter API JSON call not getting latest 3 Tweets

I have some JS that retrieves the latest 3 tweets, which is returned as JSON from Twitter. 我有一些JS可以检索最新的3条推文,这些推文是从Twitter作为JSON返回的。

Suddenly, today, only 2 Tweets were showing. 突然之间,今天仅显示2条Tweets。 I noticed twitter limits this latest to the last 7 days. 我注意到Twitter将最新消息限制为最近7天。 Fine I thought, so I tweet again...however, still, only 2 tweets are showing, despite there being more than 3 tweets made in the last week. 好的,我想,所以我再发一次推文...但是,尽管上周发了3条以上的推文,但仍然只显示2条推文。

Here is my URL I am calling: 这是我正在呼叫的URL:

https://twitter.com/statuses/user_timeline.json?screen_name=tokheimgroup&count=3&callback= ? https://twitter.com/statuses/user_timeline.json?screen_name=tokheimgroup&count=3&callback=吗?

If you then examine this page: 如果您随后检查此页面:

https://twitter.com/tokheimgroup https://twitter.com/tokheimgroup

You'll notice that in the JSON returned from the first link, the re-tweet is not being returned as the 3rd tweet. 您会注意到,在从第一个链接返回的JSON中,重新发送的推文并未作为第三条发送。 Is there an additional parameter to include re-tweets? 是否有其他参数可以包含重推?

Thanks! 谢谢!

It's ok, I managed to figure this out. 没关系,我设法弄清楚了。

When getting 3 tweets (or whatever number) Twitter doesn't include by default re-tweets, but still counts to the number you're looking for. 当获得3条推文(或任何数字)时,Twitter默认不包含重新推文,但仍计入您要查找的数字。 This in my opinion is wrong, but hey, that's how they have it set up. 我认为这是错误的,但是,嘿,这就是他们的设置方法。

To include retweets as part of this number, you need to set the paramaer: 要将转推包括为该号码的一部分,您需要设置参数:

include_rts=true include_rts =真

So now my original URL looks something like this: 所以现在我的原始网址看起来像这样:

https://twitter.com/statuses/user_timeline.json?screen_name=tokheimgroup&count=3&include_rts=true&callback=?

Phew! 唷!

Hope this helps someone. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM