1

I am after a twitter feed of search terms and can find nothing on the internet other than single purpose widgets of no benefit to us.

We want a the results of a twitter search to display on a page.

For example if one of our pages is about golf I want to be able to pull tweets about golf (say 10) and style them myself based on our theme layouts. I do not want a conveluted widget with style attributes and theme files. Just the actual text from tweets about golf. No authors or dates if possible. Just the text and thats it.

Any ideas?

Marvellous

Walrus
  • 19,801
  • 35
  • 121
  • 199

4 Answers4

1

The API provides everything you're looking for. Using a server-side RSS reader, it's as simple as pointing at the following URI: (will return results for #golf.)

http://search.twitter.com/search.atom?q=%23golf

Keeping everything client-side is just as easy using JSONP:

http://search.twitter.com/search.json?q=%23golf&callback=?

The jQuery code would look something like this:

var url = "http://search.twitter.com/search.json?q=%23golf&callback=?";

$.getJSON(url, function(data)
{
  $("#golfTweets").empty();
    $.each(data.results, function()
    {
      var $newTweet = $("#tweetTemplate").clone();
      $newTweet.find(".body").text(this.text);
      $("#golfTweets").append($newTweet);
      $newTweet.show();
    }
}

Assuming this HTML:

<div id="golfTweets">
  <div id="tweetTemplate" style="display:none;">
    <span class="body" />
  </div>
</div>
Peter J
  • 57,680
  • 8
  • 38
  • 45
  • Thanks for your help however It did not appear to work at all. I have read through the documentation and built a function. My function however works for every feed except twitters feed. Ill post the new question here :: http://stackoverflow.com/questions/6001765/php-xml-feed-assembler-works-for-every-feed-except-twitter – Walrus May 14 '11 at 12:18
0

Its very easy to get tweets based on search terms, whether its users, words, or hashtags in either xml or json check outthe docs here

locrizak
  • 12,192
  • 12
  • 60
  • 80
0

you can retrieve result through twitter search api. You can get the result in xml or json , then you can freely edit css to style your content to whatever you want. I've found a good tutorial for you : php+css+twitter

Dzung Nguyen
  • 9,152
  • 14
  • 65
  • 104
0

I figured out an easy way to create a custom Twitter feed of the search results for a specific term. You can read my blog post which gives you all the CSS, Javascript and HTML code that you need to make the Twitter feed at http://icode4you.net/creating-a-custom-twitter-feed-with-search-results.

To create a Twitter feed of tweets that contain the word "golf" (using your example above), you would simply change this line in the Javascript file (created from the codes provided in my blog post):

$.getJSON("http://search.twitter.com/search.json?q=thelibzter&callback=?", function(data)

To this:

$.getJSON("http://search.twitter.com/search.json?q=golf&callback=?", function(data) 

Hope that helps!

TheLibzter
  • 768
  • 8
  • 8