Posts

Showing posts from August, 2017

How to Search Tweets using Twitter4j Java API

Image
In a recent SEO related project, I used Twitter4J Java API to download 3 million plus tweets. Below is the proof of concept code. There are only three major steps: 1. Download the latest Twitter4J JAR file from http://twitter4j.org/en/  and add into your project library or class path. 2. Create Twitter App by visting https://apps.twitter.com/ Click Create New App button and fill the form by providing app name, URL and app brief description and submit clicking on "Create New Twitter Applicaton" button. Once the application is created, click the application name on dashboard and go to Key and Access Toekn tab. There would see Consumer Key (API Key), Consumer Secret (API Secret). Click on Generate Access Token and Token secret button, it would generate Access Token and Access Token Secret. These 4 things are what you need when making the API call. 3. Just use below code, as-is, it shall fetch the tweets. Modify the code as per your requirements. Its self