Gopinath
Gopinath

Reputation: 184

Twitter json not working

I have used twitter JSON using JQuery before. But it doesn't seem to work now. Is the twitter server down or am I doing something wrong?

This is my code:

    //Twitter

    $(function() {
        var twitterBaseURL = 'http://twitter.com/status/user_timeline/archies4000.json?count=1&callback=?';
        var html = '';
        var num_of_tweets=0;
        $.getJSON(twitterBaseURL, function(json) {
            $.each(json, function(i, item) {
                num_of_tweets=i+1;
                var text = $.toLink(item.text);
                var profileImageURL = item.user.profile_image_url;
                var time_arr= item.created_at.split(" ");
                var time=time_arr[1]+" "+time_arr[2];
                html += '<p>' + text + ' on '+ time + '</p>';
            });
            $('#twt-desc').html(html);
            $('#twt-pic').append('<img src="'+profileImageURL+'" alt="VPULTS" />');
        });
    });

I even tried directly entering the URL (http://twitter.com/status/user_timeline/archies4000.json?count=1&callback=?) in the browser to get the JSON in the browser itself. It is showing:

({"errors":[{"message":"Sorry, that page does not exist","code":34}]});

Thank you.

Upvotes: 2

Views: 500

Answers (1)

Gopinath
Gopinath

Reputation: 184

I got the answer...Twitter did some housekeeping recently:

https://dev.twitter.com/discussions/10803

The URL needs to be changes to:

https://api.twitter.com/1/statuses/user_timeline/username.json?count=1&callback=?

Thanks to @Lloyd for pointing me in the right direction

Upvotes: 1

Related Questions