Created
December 12, 2012 09:46
-
-
Save vjk2005/4266450 to your computer and use it in GitHub Desktop.
Get user's tweets from anywhere ( cross-domain )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't work from Chrome console on twitter.com for some reason.