Pulling Retweets using Twitter user_timeline in JS

2019-04-02 12:59发布

I'm currently using the script..

http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&count=1

.. to pull the most recent Tweet for a number of users to display on my website. However, I've ran into the problem that the JSON format doesn't display Retweets. I've read from this link that you must use "retweeted_by_me" to also display Retweets by I'm not quite sure how I would merge that with my current script.

标签: twitter
3条回答
疯言疯语
2楼-- · 2019-04-02 13:19

Change response mode to rss. This will resolve the issue. It might require change in the display code depending on your scripting language though.

查看更多
在下西门庆
3楼-- · 2019-04-02 13:29

If you read the GET statuses/user_timeline documentation you fill find that by adding a parameter of include_rts set to true it will include retweets.

查看更多
一纸荒年 Trace。
4楼-- · 2019-04-02 13:30

EDIT : As of Twitter API Version 1.1, use the following format. (Needs Authenticaton)

https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true

The updated documentation can be found here

https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

[UPDATE] The following methods apply to Twitter API Version 1 and is Deprecated now.

Use the new twitter API and add include_rts=true Eg: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true

Full documentation can be found here : http://dev.twitter.com/doc/get/statuses/user_timeline

查看更多
登录 后发表回答