Twitter Timeline - How do I enable retweets?

This downloads the Twitter feed and displays the latest tweet.

Is there a way to enable and restore all retweets in this function?

$(document).ready(function() { var url = "http://twitter.com/status/user_timeline/mytwittername.json?count=3&callback=?"; var lastClass = ""; $.getJSON(url, function(data){ $.each(data, function(i, item) { // check for last tweet if (i == (data.length - 1)) { lastClass = "class='last'" } $("#twitter-content ul").append("<li " + lastClass + ">" + item.text.linkify().atify() + " <span class='created_at'>[" + relative_time(item.created_at) + " via " + item.source + "]</span></li>"); }); }); $("#sidebar ul li:last-child").addClass("last"); }); 
+4
source share
2 answers

Change the url variable in the code as follows:

 http://api.twitter.com/1/statuses/user_timeline/mytwittername.json?count=3&include_rts=1&callback=? 

The magic is in the include_rts=1 parameter, which will force retweets by the target user to be included in their timeline.

The statuses / user_timeline method does not require authentication, however, if you perform authentication, you will receive an additional 200 API calls per hour. Please note that twitter.com REST methods are no longer supported, so be sure to use the API methods with the version when interacting with Twitter.

+6
source

Take a look here:

https://dev.twitter.com/docs/api/1/get/statuses/retweets/:id

In your loop, if you have the id of the original tweet, you can also get a retweet.

I have not tried, but this is what I found.

Good luck

0
source

All Articles