• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extract tweets from Twitter

 
udayshankar kintali
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to extract tweets from twitter based on a hashtag. Can anyone help me in this? Sample code or twitter api which is required for this?
 
Rob Spoor
Sheriff
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used Twitter4J myself with quite a bit of success. However, you can do it with simple HTTP requests as well; check https://dev.twitter.com/docs/api/1/get/search for more information. A simple example to get results in XML format (you need to URL encode the # into %23): http://search.twitter.com/search.atom?q=%23rob
 
udayshankar kintali
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

I have tried the code given here http://twitter4j.org/en/code-examples.html
This worked but I am getting only a limited number of tweets. Is there a limit on the number tweets per execution? I tried executing the program twice, and I got the same result.


Regarding the link you gave, Is it a REST call(webservice call) where you are sending the request in XML format and getting the response in XML?
 
Rob Spoor
Sheriff
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is indeed a limitation for tweets. As far as I have seen from experimentation, the number of tweets returned by any query is at most 1500 (not sure if this maximum is accurate). There is also a time-limitation of (again from experimentation) about a week.

As for the second link, you don't send XML, just simple HTTP parameters. The first link shows which parameters it can accept.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic