tags:

views:

879

answers:

3

I'm using the Twitter-generated "Twitter Badge" HTML and JavaScript to show my Twitter feed on a web page. I'd like to include the replies to me in the same feed, or at least in another one. (My replies to others are already in there.) One the Twitter site, I just click on the @username link on the right panel and get the #replies for my userid. Does anybody know how to embed that in a page? Thanks.

+2  A: 

There's an API method that will let you pull the 20 most recent @replies in XML or JSON format; however, it requires authentication, so you'll want to do this on the backend. (There are OAuth libraries for Javascript, but that doesn't sound especially workable to me for this use case.)

Meredith L. Patterson
+1  A: 

As long as you use twitter regularly enough to have tweets in search(expires after sometime), you could use twitter searches jsonp.

I wrote a simple js lib around it. http://gist.github.com/110884

That will give you an array of matching tweets that you can then style or whatever.

//done up in no framework js
Twitter.search({q:"alan",
  callback:function(results){
    var body = document.getElementsByTagName("body")[0];
    for(var i=0;i<results.length;i++)
    {
      alert(results[i].text)
    }
  }
})
BaroqueBobcat
+1  A: 

Have you considered using Juitter - jQuery Plugin for Twitter?

Dan Diplo
No. Thanks; I'll check that out immediately.
Alan
Like @BaroqueBobcat's suggestion, Juitter -- which is pretty cool, I must say -- relies on search. I was looking for direct timeline data: tweets by a given user id (me) and all the @replies to it. That way the data persists longer than in search. I think I shall have to write something myself using the API.
Alan

related questions