/ Published in: jQuery
As of my ongoing preparation for the 1K tweet :) I was interested to see the 1000th tweet from some friends timeline. And when I didn't find an existing method, I thought I could write few jQuery lines to solve this..
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 1- Get User's Tweets Count function getTweetCount(username,n) { $.ajax({ url:'http://twitter.com/users/show.json' ,data:{screen_name:username} ,dataType:'jsonp' ,success:function(json){ // Can not go back more than 3200 tweet var min = json.statuses_count-3200; // min can not be less than 0 if(min<0) min =0; // n has to be greater than min and less than tweet count if(n>min && n<=json.statuses_count) { // page = count - Nth + 1 getLatestTweet(username, json.statuses_count - n + 1); } } }); } // 2- Get User's Nth Tweet function getLatestTweet(username,page) { $.ajax({ url:'http://twitter.com/statuses/user_timeline.json' ,data:{screen_name:username,count:1,page:page} ,dataType:'jsonp' ,success:function(json){ if(json.length) showTweet(json[0]); } }); }
URL: http://www.moretechtips.net/2010/02/nearing-my-1000th-tweet-using-jquery-to.html