Recently Twitter updated its API to v1.1 and my program stops working but no matter how much documentation I read, I can't seem to really understand what is needed to make my codes work.
My used-to-work codes are as below :
function getTweets() {
var url = 'http://search.twitter.com/search.json?q=%23yolo&rpp=10&result_type=recent&callback=?';
$.getJSON(url, function (json) {
display = [];
displayDateTime = [];
if (json.results.length != null) {
for (var i = 0; i < json.results.length; i++) {
var time = new Date(json.results[i].created_at);
display.push("@" + json.results[i].from_user + ": " + json.results[i].text);
displayDateTime.push("[" + time.toString().substring(0, 19) + "]");
} //end of for loop
display.reverse();
displayDateTime.reverse();
loadOtherStuffs();
} //end of if
else {
setTimeout(getTweets, 24000);
}
}); //end of getJSON
}//end of getTweets()
I tried changing the url to https://api.twitter.com/1.1/search/tweets.json and json.results
to json.statuses
but it still won't work. It seems that there's a need for oAuth
to make this work again but I'm not too sure.
What are exactly the steps to make this work again?