Twitter user_timeline API 不显示转发
我在将 Twitter API 集成到我的网站以制作我的最新推文的小型提要时遇到问题。 我使用以下 URL 调用 JSON API:
http://twitter.com/statuses/user_timeline.json?screen_name=<我的用户名>&count=2
我得到了一个正确的提要,当我解析它时,它完全没问题。尽管我注意到在我从我的帐户转发一条推文后,JSON 提要开始在底部显示少一条条目(我有 2 条推文,现在显示 1 条)。
我认为这是因为 API 现在返回两条推文,其中一条是我的转发,并且弹出了最旧的推文,尽管转发没有显示。
检查 API 返回的实际 JSON 代码后,我发现没有我最旧的推文(弹出的那条)和新转发的痕迹。唯一显示的推文是我的第二条推文,即我转发之前的那一条。
有谁知道如何解决这个问题?我不希望我的网站上的流显示转发,所以这没关系,但我也不希望我的转发使真正的推文消失。
提前致谢。
I'm having a problem with integrating the Twitter API into my website to make a small feed of my latest tweets.
I call the JSON API using this URL:
http://twitter.com/statuses/user_timeline.json?screen_name=<my username>&count=2
I get a proper feed, and when I parse it it's completely fine. Though I noticed that after I retweeted a tweet from my account, the JSON feed started showing one less entry at the bottom (I had 2 tweets, now it's showing 1).
I thought that it was because the API was now returning two tweets one of which was my retweet, and had popped out the oldest tweet, though the retweet was not showing up.
After inspecting the actual JSON code returned by the API, I discovered that there's no trace of my oldest tweet (the one that popped away) nor of the new retweet. The only shown tweet is my second one, the one before I retweeted.
Does anyone know how to solve that? I don't want the stream on my website to show retweets, so this is okay, but I also don't want my retweets to make the real tweets disappear.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Twitter 提供了
include_rts
参数。count
似乎是包括 转发的计数,即使您没有启用include_rts
(在我看来,这非常蹩脚/烦人) )。Twitter has provided the
include_rts
parameter. Thecount
seems to be the count including retweets, even if you don't haveinclude_rts
enabled (which in my opinion is quite lame/annoying).count
并不承诺返回多少条推文。它更多的是一个最大计数。如果您想增加收到两条正常推文的机会,请将count
设置为 10 或 20,并仅显示最新的两条。count
is not a promise of how many tweets will be returned. It is more a max count. If you want to increase your chances of receiving two normal tweets setcount
to 10 or 20 and only display the latest two.从 user_timeline 的 api 文档这里我建议再发一些推文看看问题是否仍然存在,这可能只是一个侥幸。
From the documentation on the api for the user_timeline here I would suggest making some more tweets to see if the problem continues, it may have just been a fluke.