Skip to content

Instantly share code, notes, and snippets.

@vjk2005
Created December 12, 2012 09:46
Show Gist options
  • Save vjk2005/4266450 to your computer and use it in GitHub Desktop.
Save vjk2005/4266450 to your computer and use it in GitHub Desktop.
Get user's tweets from anywhere ( cross-domain )
var s = document.createElement( 'script' );
s.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js';
document.body.appendChild( s ); // load jQuery
var
screen_name = "qtbrowneyes"
, this_many_tweets = 40;
function getTweets( screen_name, this_many_tweets ) {
$.getJSON( 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=' + screen_name + '&callback=?&count=' + this_many_tweets + '',
function( tweets ) {
for( tweetID in tweets ){
console.log( tweets[tweetID].text );
}
});
}
getTweets( screen_name, this_many_tweets );
@vjk2005
Copy link
Author

vjk2005 commented Dec 12, 2012

Doesn't work from Chrome console on twitter.com for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment