All Projects → takke → twitter4j-v2

takke / twitter4j-v2

Licence: Apache-2.0 License
a simple wrapper for Twitter API v2 that is designed to be used with Twitter4J

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to twitter4j-v2

Yatcobot
Yatcobot (Yet another twitter contest bot) is the most advanced and configurable bot for twitter contests and giveaways
Stars: ✭ 60 (+172.73%)
Mutual labels:  twitter-api
mcafee2cash
A crypto trading bot powered by McAfee tweets
Stars: ✭ 38 (+72.73%)
Mutual labels:  twitter-api
TwitterPiBot
A Python based bot for Raspberry Pi that grabs tweets with a specific hashtag and reads them out loud.
Stars: ✭ 85 (+286.36%)
Mutual labels:  twitter-api
GraphiPy
GraphiPy: Universal Social Data Extractor
Stars: ✭ 61 (+177.27%)
Mutual labels:  twitter-api
nicar tworkshop
Slides for #NICAR18 workshop on collecting and analyzing Twitter data
Stars: ✭ 23 (+4.55%)
Mutual labels:  twitter-api
Archive-Tweets
Archive and Delete Liked and Posted Tweets
Stars: ✭ 28 (+27.27%)
Mutual labels:  twitter-api
Raymo111
My awesome profile README
Stars: ✭ 110 (+400%)
Mutual labels:  twitter-api
markdown-tweet-scheduler
Schedule daily tweets from markdown files in your repo, posted via github actions.
Stars: ✭ 49 (+122.73%)
Mutual labels:  twitter-api
shut-up-bird
🐦 Put your tweets/likes in an EPUB and delete them like a boss
Stars: ✭ 22 (+0%)
Mutual labels:  twitter-api
twgitbot
A node.js bot that checks a github repo changes and tweets it to your Twitter account
Stars: ✭ 10 (-54.55%)
Mutual labels:  twitter-api
labs-sample-code
Sample code for Twitter Developer Labs
Stars: ✭ 25 (+13.64%)
Mutual labels:  twitter-api
twitter-flood-generator
Simple Command Line Utility for Generating Twitter Floods
Stars: ✭ 61 (+177.27%)
Mutual labels:  twitter-api
cspan data
A repo for tracking the number of followers of Congress, the Cabinet, and Governors
Stars: ✭ 16 (-27.27%)
Mutual labels:  twitter-api
dtwitter
Script used in the DTwitter shortcut, currently available on RoutineHub
Stars: ✭ 26 (+18.18%)
Mutual labels:  twitter-api
tweet-to-image
Convert tweets to beautiful images
Stars: ✭ 134 (+509.09%)
Mutual labels:  twitter-api
rtweet.download
{rtweet} helpers for automating large or time-consuming downloads
Stars: ✭ 24 (+9.09%)
Mutual labels:  twitter-api
monkehTweets
A ColdFusion wrapper to interact with the Twitter API (with OAuth integration)
Stars: ✭ 52 (+136.36%)
Mutual labels:  twitter-api
archive-explorer-web
Browse your Twitter archive with a friendly, responsive, full experience, and quickly delete the tweets you don't want.
Stars: ✭ 19 (-13.64%)
Mutual labels:  twitter-api
tweetsOLAPing
implementing an end-to-end tweets ETL/Analysis pipeline.
Stars: ✭ 24 (+9.09%)
Mutual labels:  twitter-api
twitter-stream-api
Consume the Twitter Stream API in real-time.
Stars: ✭ 19 (-13.64%)
Mutual labels:  twitter-api

v2 CI

twitter4j-v2

twitter4j-v2 is a simple wrapper for Twitter API v2 that is designed to be used with Twitter4J.

More information is here.

How do I use it?

Setup

Dependencies
repositories {
    mavenCentral()
}

dependencies {
    implementation "io.github.takke:jp.takke.twitter4j-v2:$twitter4jV2Version"
}

// the old way: until v1.0.3
repositories {
    maven {
        url 'https://takke.github.io/maven'
        content {
            includeGroup "jp.takke.twitter4j-v2"
        }
    }
}
dependencies {
    implementation "jp.takke.twitter4j-v2:twitter4j-v2-support:$twitter4jV2SupportVersion"
}

see search.maven.org

Example

val twitter: Twitter = yourTwitterInstanceProvider.get()
val tweetId = 656974073491156992L

val tweetsResponse = twitter.getTweets(tweetId,
                            mediaFields = null,
                            placeFields = null,
                            pollFields = "duration_minutes,end_datetime,id,options,voting_status",
                            tweetFields = "id,public_metrics",
                            userFields = null,
                            expansions = "attachments.poll_ids")

println(tweetsResponse.tweets[0].poll(tweetsResponse.pollsMap))
// or
println(tweetsResponse.pollsMap[tweetsResponse.tweets[0].pollId])

// => Poll(id=656974073113636864, options=[PollOption(position=1, label=Roboto, votes=391), 
//    PollOption(position=2, label=San Francisco, votes=691)], 
//    votingStatus=CLOSED, endDatetime=Fri Oct 23 08:23:19 GMT+09:00 2015, durationMinutes=1440)

See more examples in kotlin and java.

Requirements

  • Kotlin 1.6.0
  • Twitter4J 4.0.7

Supported APIs

End-point twitter4j-v2 method
Tweets Tweet Lookup GET /2/tweets Twitter.getTweets()
Manage Tweets POST /2/tweets Twitter.createTweet()
DELETE /2/tweets/:id Twitter.deleteTweet()
Timelines GET /2/users/:id/tweets Twitter.getUserTweets()
GET /2/users/:id/mentions Twitter.getUserMentions()
Search Tweets GET /2/tweets/search/recent Twitter.searchRecent()
GET /2/tweets/search/all Twitter.searchAll()
Tweet counts GET /2/tweets/counts/recent Twitter.countRecent()
GET /2/tweets/counts/all Twitter.countAll()
Filtered stream GET /2/tweets/search/stream N/A #1
Volume stream GET /2/tweets/sample/stream N/A #1
Retweets lookup GET /2/tweets/:id/retweeted_by Twitter.getRetweetUsers()
Manage Retweets POST /2/users/:id/retweets Twitter.retweet()
DELETE /2/users/:id/retweets/:source_tweet_id Twitter.unretweet()
Likes lookup GET /2/tweets/:id/liking_users Twitter.getLikingUsers()
GET /2/users/:id/liked_tweets Twitter.getLikedTweets()
Manage Likes POST /2/users/:id/likes Twitter.likeTweet()
DELETE /2/users/:id/likes/:tweet_id Twitter.unlikeTweet()
Hide replies PUT /2/tweets/:id/hidden N/A (Twitter4J v4.0.7 does not support PUT methods that contain json parameters.)
Users Users lookup GET /2/users Twitter.getUsers()
GET /2/users/by Twitter.getUsersBy()
Follows lookup GET /2/users/:id/following Twitter.getFollowingUsers()
GET /2/users/:id/followers Twitter.getFollowerUsers()
Manage follows POST /2/users/:id/following Twitter.followUser()
DELETE /2/users/:source_user_id/following/:target_user_id Twitter.unfollowUser()
Blocks lookup GET /2/users/:id/blocking Twitter.getBlockingUsers()
Manage blocks POST /2/users/:id/blocking Twitter.blockUser()
DELETE /2/users/:source_user_id/blocking/:target_user_id Twitter.unblockUser()
Mutes lookup GET /2/users/:id/muting Twitter.getMutingUsers()
Manage mutes POST /2/users/:id/muting Twitter.muteUser()
DELETE /2/users/:source_user_id/muting/:target_user_id Twitter.unmuteUser()
Spaces Spaces lookup GET /2/spaces Twitter.getSpaces()
GET /2/spaces/by/creator_ids Twitter.getSpacesByCreatorIds()
Spaces search GET /2/spaces/search Twitter.searchSpaces()
Lists Lists lookup GET /2/lists/:id Twitter.getList()
GET /2/users/:id/owned_lists Twitter.getOwnedLists()
Manage Lists POST /2/lists Twitter.createList()
DELETE /2/lists/:id Twitter.deleteList()
PUT /2/lists/:id N/A (Twitter4J v4.0.7 does not support PUT methods that contain json parameters.)
Lists Tweets lookup GET /2/lists/:id/tweets Twitter.getListTweets()
List members GET /2/lists/:id/members Twitter.getListMembers()
GET /2/users/:id/list_memberships Twitter.getListMemberships()
POST /2/lists/members Twitter.addListMember()
DELETE /2/lists/members/:user_id Twitter.deleteListMember()
Lists follows GET /2/lists/:id/followers Twitter.getListFollowers()
GET /2/users/:id/followed_lists Twitter.getFollowedLists()
POST /2/users/:id/followed_lists Twitter.followList()
DELETE /2/users/followed_lists/:list_id Twitter.unfollowList()
Pinned Lists GET /2/users/:id/pinned_lists Twitter.getPinnedLists()
POST /2/users/:id/pinned_lists Twitter.pinList()
DELETE /2/users/pinned_lists/:list_id Twitter.unpinList()

v2 APIs table from Twitter API endpoint map

See also Response Field Mapping

Developed By

TAKEUCHI Hiroaki (@takke) - takke30 at gmail.com

License

Copyright 2020 takke

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].