• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Extract tweets from Twitter

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic