| Author |
Extract tweets from Twitter
|
udayshankar kintali
Greenhorn
Joined: Jan 15, 2012
Posts: 15
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
|
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
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
udayshankar kintali
Greenhorn
Joined: Jan 15, 2012
Posts: 15
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
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.
|
 |
 |
|
|
subject: Extract tweets from Twitter
|
|
|