All Projects → redouane59 → twittered

redouane59 / twittered

Licence: Apache-2.0 license
Twitter API client for Java developers

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to twittered

twitter-crypto-bot
This is a Twitter bot that tweets about cryptocurrencies prices every certain amount of minutes
Stars: ✭ 21 (-87.65%)
Mutual labels:  twitter-bot, twitter-api
search-tweets-ruby
Ruby client for the Twitter search endpoints (v2/Labs/premium/enterprise). Now supports Twitter API v2 /recent and /all search endpoints.
Stars: ✭ 45 (-73.53%)
Mutual labels:  twitter-api, twitter-api-v2
TwitterAutoReplyBot
This is a tiny Python script that replies to a specified number of tweets containing a specified hashtag.
Stars: ✭ 33 (-80.59%)
Mutual labels:  twitter-bot, twitter-api
TwitterScraper
Scrape a User's Twitter data! Bypass the 3,200 tweet API limit for a User!
Stars: ✭ 80 (-52.94%)
Mutual labels:  twitter-bot, twitter-api
command-line-tweeter
Tweets in from a pipe
Stars: ✭ 70 (-58.82%)
Mutual labels:  twitter-client, twitter-cli
larry
Larry 🐦 is a really simple Twitter bot generator that tweets random repositories from Github built in Go
Stars: ✭ 64 (-62.35%)
Mutual labels:  twitter-bot, twitter-api
twitter-like-bot
This app allows you to automate Twitter liking for specific keywords, hashtags, or even full sentences. The bot uses streaming API which means that everything happens in real time.
Stars: ✭ 30 (-82.35%)
Mutual labels:  twitter-bot, twitter-api
Awesome Twitter Tools
A curated list of awesome twitter tools
Stars: ✭ 113 (-33.53%)
Mutual labels:  twitter-api, twitter-client
Stranger Things Wall
A wall of addressable LEDs inspired by the Netflix series Stranger Things that displays messages from Twitter.
Stars: ✭ 22 (-87.06%)
Mutual labels:  twitter-api, twitter-search
TinyFlowerBeds
Educational bot that posts a tiny flower bed on Twitter every few hours. Check it out if you're new to Python and open source!
Stars: ✭ 12 (-92.94%)
Mutual labels:  twitter-bot, twitter-api
Raymo111
My awesome profile README
Stars: ✭ 110 (-35.29%)
Mutual labels:  twitter-bot, twitter-api
Twitter-bot
Twitter bot which waits for #hashTag and sends weather update of city via tweets
Stars: ✭ 20 (-88.24%)
Mutual labels:  twitter-bot, twitter-application
Harpy
A Twitter app built with Flutter
Stars: ✭ 211 (+24.12%)
Mutual labels:  twitter-api, twitter-client
twitivity
🐍 Twitter Accounts Activity API Client Library for Python
Stars: ✭ 49 (-71.18%)
Mutual labels:  twitter-api, twitter-client
Twitter Api Php
The simplest PHP Wrapper for Twitter API v1.1 calls
Stars: ✭ 1,808 (+963.53%)
Mutual labels:  twitter-api, twitter-client
twpy
Twitter High level scraper for humans.
Stars: ✭ 58 (-65.88%)
Mutual labels:  twitter-bot, twitter-api
Twitterapi
Minimal python wrapper for Twitter's REST and Streaming APIs
Stars: ✭ 724 (+325.88%)
Mutual labels:  twitter-api, twitter-client
Twitter.jl
Julia package to access Twitter API
Stars: ✭ 58 (-65.88%)
Mutual labels:  twitter-api, twitter-client
tweet-delete
Self-destructing Tweets so you too can be cool 😎
Stars: ✭ 68 (-60%)
Mutual labels:  twitter-bot, twitter-api
twspace-crawler
Script to monitor & download Twitter Spaces 24/7
Stars: ✭ 78 (-54.12%)
Mutual labels:  twitter-api, twitter-api-v2

This project is a JAVA library which allows you to consume the Twitter API.

v2

Standard

Premium

Configuration

Maven Central

In your pom.xml, add the following dependency and replace VERSION with the version you wish:

<dependency>
  <groupId>io.github.redouane59.twitter</groupId>
  <artifactId>twittered</artifactId>
  <version>VERSION</version>
</dependency>

If you are using Gradle Kotlin DSL, make sure you have MavenCentral among the available repositories:

repositories {
    mavenCentral()
    // [...]
}

Then add the following line to your dependencies block:

implementation("io.github.redouane59.twitter:twittered:VERSION")

To be able to see library logs, also add sl4j references :

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.30</version>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-simple</artifactId>
  <version>1.7.30</version>
</dependency>

In order to use your own developer credentials, you have several options :

Using a json file

File example :

{
  "apiKey": "xxx",
  "apiSecretKey": "xxx",
  "accessToken": "xxx",
  "accessTokenSecret": "xxx"
}
With program argument

Pass through java argument your file path like -Dtwitter.credentials.file.path=/your/path/to/json . Then instantiate the client like

TwitterClient client = new TwitterClient();

or

Using deserialization in your code
TwitterClient twitterClient = new TwitterClient(TwitterClient.OBJECT_MAPPER
                                                    .readValue(new File("/your/path/to/json"), TwitterCredentials.class));

With hard-coded values

TwitterClient twitterClient = new TwitterClient(TwitterCredentials.builder()
                                                            .accessToken("<access_token>")
                                                            .accessTokenSecret("<secret_token>")
                                                            .apiKey("<api_key>")
                                                            .apiSecretKey("<secret_key>")
                                                            .build());

NB : Your twitter credentials can be found in your twitter app page in the Key and tokens page.

Available methods

See :

Code samples

See :

Basic examples

1. Init TwitterClient

TwitterClient twitterClient = new TwitterClient(TwitterClient.OBJECT_MAPPER
                                  .readValue(new File("/your/path/to/json"), TwitterCredentials.class));

2. Get Tweet object from tweet id and display some information

Tweet  tweet   = twitterClient.getTweet("1224041905333379073");
System.out.println(tweet.getText());
System.out.println(tweet.getCreatedAt());
System.out.println(tweet.getLang());
System.out.println(tweet.getLikeCount());
System.out.println(tweet.getRetweetCount());
System.out.println(tweet.getReplyCount());
System.out.println(tweet.getUser().getName());

3. Get User object from username and display some information

User   user   = twitterClient.getUserFromUserName("RedouaneBali");
System.out.println(tweet.getUser().getName());
System.out.println(tweet.getUser().getDisplayedName());
System.out.println(tweet.getUser().getDateOfCreation());
System.out.println(tweet.getUser().getDescription());
System.out.println(tweet.getUser().getTweetCount());
System.out.println(tweet.getUser().getFollowersCount());
System.out.println(tweet.getUser().getFollowingCount());
System.out.println(tweet.getUser().getPinnedTweet());
System.out.println(tweet.getUser().getPinnedTweet());
System.out.println(tweet.getUser().getLocation());
System.out.println(tweet.getUser().getId());
System.out.println(tweet.getUser().getUrl());

Contribution

If you want to contribute to the project, don't hesitate to submit pull requests. To add a new feature :

  • Create the interface method in the related interface ( e.g ITwitterClientV2.java)
  • If needed, add the endpoint URL in URLHelper.java
  • Implement your method in the child class ( e.g TwitterClient.java)
  • Don't forget to add your unit tests in src/test/java/io/github/redouane59/twitter/unit

Code style is also available in .idea/codeStyles/GoogleStyle.xml file.

External Resources

Twitter Developers docs

Special thanks

I would like to give special thanks to @hypr2771 @mmornati @andypiper @igorbrigadir @sparack for having helped me building this Twitter API library for Java. The tool is now working and I hope that students, junior and senior developers will enjoy it, being able to play easily with twitter data using Java programming language.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].