All Projects β†’ twitterdev β†’ Twitter Api V2 Sample Code

twitterdev / Twitter Api V2 Sample Code

Licence: apache-2.0
Sample code for the Twitter API early access endpoints (Python, Java, Ruby, and Node.js).

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Twitter Api V2 Sample Code

Twitterdelete
πŸ’€ Delete your old, unpopular tweets.
Stars: ✭ 231 (-24.51%)
Mutual labels:  twitter-api, twitter
Surfbird
A Microblogging client built on Electron and Vue
Stars: ✭ 309 (+0.98%)
Mutual labels:  twitter-api, twitter
Egg Mode
a twitter api crate for rust
Stars: ✭ 249 (-18.63%)
Mutual labels:  twitter-api, twitter
Coretweet
Yet Another .NET Twitter Library
Stars: ✭ 281 (-8.17%)
Mutual labels:  twitter-api, twitter
twitter-stream-api
Consume the Twitter Stream API in real-time.
Stars: ✭ 19 (-93.79%)
Mutual labels:  twitter, twitter-api
Tweetledee
A PHP library that provides an incredibly easy way to access Twitter data as JSON or RSS feed by URL or standard CLI syntax.
Stars: ✭ 208 (-32.03%)
Mutual labels:  twitter-api, twitter
Twitter Scraper
Scrape the Twitter Frontend API without authentication.
Stars: ✭ 3,037 (+892.48%)
Mutual labels:  twitter-api, twitter
Csscreatures
Make a creature by tweeting to @csscreatures
Stars: ✭ 144 (-52.94%)
Mutual labels:  twitter-api, twitter
Archive-Tweets
Archive and Delete Liked and Posted Tweets
Stars: ✭ 28 (-90.85%)
Mutual labels:  twitter, twitter-api
shut-up-bird
🐦 Put your tweets/likes in an EPUB and delete them like a boss
Stars: ✭ 22 (-92.81%)
Mutual labels:  twitter, twitter-api
Twitter To Sqlite
Save data from Twitter to a SQLite database
Stars: ✭ 203 (-33.66%)
Mutual labels:  twitter-api, twitter
markdown-tweet-scheduler
Schedule daily tweets from markdown files in your repo, posted via github actions.
Stars: ✭ 49 (-83.99%)
Mutual labels:  twitter, twitter-api
Twitter Bot
Node js twitter bot to send auto welcome message for your new followers
Stars: ✭ 184 (-39.87%)
Mutual labels:  twitter-api, twitter
Harpy
A Twitter app built with Flutter
Stars: ✭ 211 (-31.05%)
Mutual labels:  twitter-api, twitter
Twitter Api Php
The simplest PHP Wrapper for Twitter API v1.1 calls
Stars: ✭ 1,808 (+490.85%)
Mutual labels:  twitter-api, twitter
labs-sample-code
Sample code for Twitter Developer Labs
Stars: ✭ 25 (-91.83%)
Mutual labels:  twitter, twitter-api
Twurl
OAuth-enabled curl for the Twitter API
Stars: ✭ 1,648 (+438.56%)
Mutual labels:  twitter-api, twitter
Twitwork
Monitor twitter stream
Stars: ✭ 133 (-56.54%)
Mutual labels:  twitter-api, twitter
bird-elephant
PHP client library for Twitter API v2 endpoints.
Stars: ✭ 28 (-90.85%)
Mutual labels:  twitter, twitter-api
TwitterPiBot
A Python based bot for Raspberry Pi that grabs tweets with a specific hashtag and reads them out loud.
Stars: ✭ 85 (-72.22%)
Mutual labels:  twitter, twitter-api

Twitter API v2 sample code v2

Sample code for early access of the Twitter v2 endpoints. Each endpoint has a folder where you can find sample code (Python, Java, Ruby, Node.js, and in some cases, R).

Getting Started

Using the code samples

In order to run the code samples in this repository you will need to create environment variables. You can find your credentials and bearer token in the App inside of your Project in the dashboard of the developer portal.

For OAuth 1.0a samples, you will need to export your consumer key and secret in your terminal. Be sure to replace <your_consumer_key> and <your_consumer_secret> with your own credentials without the < >.

export CONSUMER_KEY='<your_consumer_key>'
export CONSUMER_SECRET='<your_consumer_secret>'

For samples which use bearer token authentication, you will need to export the bearer token. Be sure to replace <your_bearer_token> with your own bearer token without the < >.

export BEARER_TOKEN='<your_bearer_token>'

Python environment set up

You will need to have Python 3 installed to run this code. The Python samples use requests==2.24.0 which uses requests-oauthlib==1.3.0.

You can install these packages as follows:

pip install requests
pip install requests-oauthlib

Ruby environment set up

You will need to have Ruby (recommended: >= 2.0.0) installed in order to run the code. The Ruby examples use typheous as the HTTP client, which needs to be gem installed. For OAuth with user context requests, you'll also need to install the oauth gem (see below).

gem install typheous
gem install oauth

JavaScript (Node.js) environment set up

You will need to have Node.js installed to run this code. All Node.js examples use needle as the HTTP client, which needs to be npm installed. For OAuth with user context requests, you'll need to install the got and oauth-1.0a packages.

npm install needle
npm install got
npm install oauth-1.0a

Java environment set up

If you use Homebrew, you can install a Java runtime using:

brew cask install java

Prerequisites

Support

Contributing

We welcome pull requests that add meaningful additions to these code samples, particularly for languages that are not yet represented here.

We feel that a welcoming community is important and we ask that you follow Twitter's Open Source Code of Conduct in all interactions with the community.

License

Copyright 2020 Twitter, Inc.

Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0

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].