Java 8 is needed to run this application.
No third-party library is used for fetching or streaming tweets from Twitter API.
- Shows Trending tweets with pagination on main page
- Subscribe to the live tweets from twitter with twitter handle, keywords and hashtags
- Up to 25 filter keywords and twitter handles can be used to stream tweets
- Stream can be stopped or connected again whenever required
- The Twitter like UI is used from codepen by Mithicher Baro with some modifications.
- Twitter API v2
Twitter only allows one Filtered Stream from one developer account with bearer token authentication. Find more info here. Also there is monthly limit on tweets can be pulled from API.
git clone https://github.com/kiran-italiya/tweetboot.git
You must have developer account to access Twitter API. If you don't have account apply for it here. Find more info about authentication and credentials and limits. For generation of bearer token follow this.
Two ways for configuring Twitter API credentials
Enter credentials directly in the file src\main\resources\application.yml
without any quotes.
tweeter:
api:
api-key: <Enter your api key here without quotes>
api-secret-key: <Enter your api secret key here without quotes>
bearer-string: Bearer <Enter your bearer token here without quotes>
bearer-token: <Enter your bearer token here without quotes>
Alternatively, set API credentials in environment variables in your OS. If the file src\main\resources\application.yml
looks like following then set TWITTER_API_KEY, TWITTER_API_SECRET_KEY, TWITTER_BEARER_TOKEN with respective values in environment. This is more secure and preferred way.
tweeter:
api:
api-key: ${TWITTER_API_KEY}
api-secret-key: ${TWITTER_API_SECRET_KEY}
bearer-string: Bearer ${TWITTER_BEARER_TOKEN}
bearer-token: ${TWITTER_BEARER_TOKEN}
Application tests are located in the package src\test\java\com\kiran\tweetboot
There are several ways to run a Spring Boot application on your local machine. One way is to execute the main
method in the src\main\java\com\kiran\tweetboot\TweetbootApplication.java
class from your IDE
Run Spring Boot App with Gradle
gradle bootRun
Follow the instructions from official documentation here.