Displaying Twitter feed stopped working

16,078

Solution 1

You need to update your code to Twitter's new API. This code will work:

<html>
    <head>
        <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
    </head>
    <body>
 <div id="twitter_update_list"></div>
            <script type="text/javascript" src="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=stackoverflow&include_rts=true&count=4&callback=twitterCallback2"></script>
</div>
    </body>
</html>

Pay attention to this line of code that is updated:

http://api.twitter.com/1/statuses/user_timeline.json?screen_name=stackoverflow&include_rts=true&count=4&callback=twitterCallback2

Solution 2

Someone recently wrote this on my blog (as a comment to an article on displaying Twitter feeds):

Just a heads up, if you are using this code I've noticed that it stopped working recently. I believe it is due to Twitter's new API. The culprit is the url that fetches the tweets. here is an updated url that seems to fix the issue: var url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=' + username + '&count=' + limit + '&callback=?';

So perhaps just slap "api" in front of "twitter.com". And the /1/ I assume is a version number.

Edit: Apparently this was correct :P

<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<div id="twitter_update_list"></div>
<script type="text/javascript" src="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=stackoverflow&include_rts=true&count=4&callback=twitterCallback2"></script>

Solution 3

looks ok to me.

here, i created a jsfiddle to test: http://jsfiddle.net/RASG/ULZBB/

try editing my jsfiddle, and see if it can help you.

Share:
16,078
Henrik Petterson
Author by

Henrik Petterson

Immigrant.

Updated on June 07, 2022

Comments

  • Henrik Petterson
    Henrik Petterson almost 2 years

    The default way to display a twitter feed has stopped working. Here is an example code:

    <html>
        <head>
            <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
        </head>
        <body>
            The feed should display below:
            <div id="twitter_update_list"> </div>
            <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/stackoverflow.json?callback=twitterCallback2&amp;count=4">
        </body>
    </html>
    

    Why is this not working? I suspected that the issue was on Twitter's end but this has not functioned for a while now. I created a fiddle in case you want to play: http://jsfiddle.net/9EvXn/

  • Henrik Petterson
    Henrik Petterson over 11 years
    It does not seem to work, maybe I made the adjustment incorrectly, check this updated fiddle: jsfiddle.net/9EvXn/1
  • powerbuoy
    powerbuoy over 11 years
    I tried in the fiddle. Didn't work for me either :/ Pretty useless answer from me I guess.
  • Henrik Petterson
    Henrik Petterson over 11 years
    No it is not useless. Maybe this can shed some light: hanselman.com/blog/…
  • Henrik Petterson
    Henrik Petterson over 11 years
    Okay I fixed the stupid thing. You where correct in your answer. Please check the fiddle and paste the code in your answer and I will accept it as correct :)
  • Henrik Petterson
    Henrik Petterson over 11 years
    Yes I managed to resolve this stupid thing with this solution: jsfiddle.net/9EvXn/4
  • Henrik Petterson
    Henrik Petterson over 11 years
    There must be millions of sites out there without a working display of feed. As most sites are using my version of code... :)
  • Mark
    Mark over 11 years
    This fixed my error for now, although it will only work until March 2013! Twitter says API 1.0 will cease accepting requests six months from when API v1.1 is released. We will officially turn off the endpoints for API v1.0 on March 5th, 2013. https://dev.twitter.com/docs/faq#10647
  • Henrik Petterson
    Henrik Petterson over 11 years
    Are you saying that this solution will not work from March: jsfiddle.net/9EvXn/4 Please elaborate on your answer Mark.
  • Mark
    Mark over 11 years
    That's what I understand from the info from Twitter via the link I posted.
  • PypeBros
    PypeBros over 11 years
    they had a channel to warn everyone about the API to become obsolete and did not used it ... sigh.
  • Henrik Petterson
    Henrik Petterson over 11 years
    Announced to a degree where no one knows about it.
  • RASG
    RASG over 9 years
    @ayjay of course it doesn's work anymore. it's a two years old answer.