Java application to access twitter account using twitter API.
- A Twitter developer account is created to access Twitter APIs.
- A Twitter app called Basic_Twitter_Application is created.
- Consumer API keys, access token, and access token secret are obtained for the twitter account using which the app is created.
- Twitter4J, an unofficial Java library for the Twitter API is used to integrate the java application with the Twitter service.
- Twitter4j library is downloaded from http://twitter4j.org and the jar file is added to the java application classpath. (twitter4j-core-4.0.4.jar is used for this application)
- In the Java project, all the required twitter4j classes such as ConfigurationBuild, TwitterFactory, Twitter, Status, Query, Trends, IDs, User, etc are imported and the following can be performed.
(‘ user’ refers to the twitter account used to generate the access tokens.)
- Display of twitter timeline of the user or any other twitter account.
- Display the trends on Twitter for a specific WOEID(Where On Earth Identifier)
- Post or delete a status to the user timeline.
- Send personal messages to the followers of the account.
- Search for tweets using keywords.
- List the friends and followers of the user.
OUTPUT