TwitterSweep is a Java Spring Boot and Javascript based Application that can stream live tweets from twitter based on given search conditions.
TwitterSweep accepts search terms from the end-user and connects to twitter via Twitter API v2 to stream live tweets from twitter that match the search terms provided by the end-user. Search terms can either be the twitter username or certain keywords that may appear in the tweets being streamed. These search terms can be easily configured using the web app which allows for easy addition or removal of search terms.
TwitterSweep is build using the Eclipse IDE. It is primarily written in Java v11 and hence requires JDK v11 to be installed on the system. TwitterSweep is a Maven project in Eclipse and hence requires the Eclipse IDE or any capable Java Development IDE that supports Maven projects such as Apache Netbeans, IntelliJ IDEA, etc for project configuration, building and running. Since TwitterSweep is build using Spring Boot, Spring Tools 4 can also be used.
- JDK v11: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html
- Eclipse IDE: https://www.eclipse.org/downloads/packages/installer
- Spring Tools 4: https://spring.io/tools
Select
File
>Import
SelectExisting Maven Projects
underMaven
ClickNext
ClickBrowse
and browse to the root directory of the maven project wherepom.xml
is located
Selectpom.xml
and ClickFinish
TwitterSweep uses Twitter API v2 to gain access to twitter and stream tweets in realtime. This requires authentication using OAuth 2.0 which users a Bearer Token for authorization. Once an app is registered on the twitter API and a Bearer Token is received, it can be added to
application.settings
file undersrc/main/resources
Theapplication.settings
file contains a propertytwitter.authorization.bearer
to configure the bearer token.
Add bearer token as followstwitter.authorization.bearer=$
, where$
must be replaced by the bearer token.
The
app.js
file undersrc/main/resources/static
contains a javascript constantMAX_TWEETS
which accepts a positive integer that controls the maximum no. of tweets being displayed in the web app.
MAX_TWEETS
>=1
Once the above steps are complete, the project needs to be build and run.
Click on theRun
icon or pressctrl + F11
to build and run the application.
Open any browser such as Goggle Chrome or Mozilla Firefox and type
localhost:8080
in the search bar and hit Enter.
TwitterSweep Web App contains a search configurator which consists of two search bars which allow for addition and deletion of search terms.
The search bar on the left is used to configure twitter usernames and the one on the right is used to configure keywords.
To add a search term, simply type it in the corresponding search bar and press theAdd
button or hit Enter. The search term will be added and displayed below the corresponding search bar.
To remove a search term, simply hover the mouse pointer over it untilX
turns from blue to red and left click to remove it.
TwitterSweep consists of two buttons
START
andSTOP
.
PressSTART
to start streaming live tweets from twitter.
PressSTOP
to stop streaming.
NOTE:
If no search terms are configured, but stream was started, then no tweets will be recieved.
Search terms can also be configured while streaming.