开发者

Grabbing tweets with a certain hastag?

Im using jquery/JS to grab the latest tweets of a account, but I want to filter the开发者_如何学Pythonm by hashtag instead.

my getJson call is: http://twitter.com/status/user_timeline/sustrans.json?count=2

I can't seem to find the documentation that says to filter these by a hastag value...

Any ideas?

Thanks


You can use the search api e.g.

http://search.twitter.com/search.json?q=%23myhashtag+from:myusername

But it will only return Tweets from the past 24 hours.

The alternative is to to get the whole timeline and pull out the Tweets you want.

var tweets = []
$.getJSON('http://twitter.com/status/user_timeline/sustrans.json?callback=?', function(data){
  for(i in data) {
    if(data[i].text.indexOf('#hastag') > -1) {
      tweets.push(data[i]);
    }
  }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜