Hi
I’ve got a problem with the below java script which currently calls the old 1v of the api.
Any help on how to change the script to make it work again? Tried putting /1.1/
$(document).ready(function() {
// set your twitter id
var user = 'studio_dog';
var userLink = 'http://twitter.com/#!/studio_dog';
var HTML = '';
// using jquery built in get json method with twitter api, return only one result
//$.getJSON('http://twitter.com/statuses/user_timeline.json?screen_name=' + user + '&count=3&callback=?', function(data) {
//$.getJSON('http://search.twitter.com/search.json?q=from:STUDIO_DOG&count=3&callback=?', function(data) {
$.getJSON('https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=STUDIO_DOG&count=3&callback=?', function(data) {
// result returned
var tweet1 = data[0].text;
// process links and reply
tweet1 = tweet1.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return '<a href="'+url+'">'+url+'</a>';
}).replace(/B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0)+'<a href="http://twitter.com/%27+reply.substring%281%29+%27">'+reply.substring(1)+'</a>';
});
var tweet2 = data[1].text;
// process links and reply
tweet2 = tweet2.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return '<a href="'+url+'">'+url+'</a>';
}).replace(/B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0)+'<a href="http://twitter.com/%27+reply.substring%281%29+%27">'+reply.substring(1)+'</a>';
});
var tweet3 = data[2].text;
// process links and reply
tweet3 = tweet3.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return '<a href="'+url+'">'+url+'</a>';
}).replace(/B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0)+'<a href="http://twitter.com/%27+reply.substring%281%29+%27">'+reply.substring(1)+'</a>';
});
HTML += "<div class='twitter-feed active'>\
<p><a href='" + userLink + "'>STUDIO_DOG</a>: " + tweet1 + " <a href='" + userLink + "'>[tweet]</a></p>\
</div>\
";
// output the result
$("#twitter_response").append(HTML);
});
});