• Stars
    star
    534
  • Rank 81,319 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A course on getting started with the Twitter API v2 for academic research

Getting started with the Twitter API v2 for academic research

banner

Welcome to this '101 course' on getting started with academic research using the Twitter API. The objective of this course is to help academic researchers learn how to get Twitter data using Twitter API v2.

By the end of this course, you will learn:

  • What the Twitter API is
  • How to apply for the Academic Research product track and what’s available in it
  • How to identify the endpoints to use for your use-case
  • How to get data from the Twitter API v2 using Python and R
  • How to write and build search queries

Who is this course for?

This is an introductory course (101), meant for anyone who is interested in getting started with the Twitter API v2 for research including

  • Academic Researchers
  • Students
  • Independent Researchers

Note: While undergraduate students & independent researchers do not qualify for the academic research product track (which provides ability to search for Tweets older than 7 days), they can still follow this course and use the standard product track and the code samples associated with it.

For most of this course, there are no prerequisites and anyone can follow along. Specifically for module 6 which is the labs, you need to know very basic coding in Python or R. If you want to first learn or review the syntax for these two languages, check out the appendix section. It provides links to introductory material on Python and R, along with instructions on how to install Python and R.

Who is this course not for?

This is designed like a 100-level course. If you already gained access to the Academic Research product track, and/or, you already know how to get data from the Twitter API v2 using Python or R, this course may feel too “introductory” for you.

How is this course structured

This course consists of 8 modules. Use this course as a complete start-to-finish lesson for getting started, or if you already know some of the basics, you can start off on one of the more advanced modules later on in the course.

  • Module 1: Learn what the Twitter API v2 is, and see examples of research done with it
  • Module 2: Learn how to apply for a Twitter developer account and how to choose the right product track for your project
  • Module 3: Learn what resources to request through the Twitter API, based on the data you need
  • Module 4: Learn how to get your keys and bearer token from the developer dashboard to start using the Twitter API
  • Module 5: Learn how to write search queries to get Tweets from the Twitter API
  • Module 6 Labs in Python and R to learn how to write code and use libraries and packages to get Twitter data
  • Module 7: Learn how to store Twitter data once you receive it, as well as data compliance and best practices
  • Module 8: See a summary of what we learned in this course and find links for important resources for future reference.

There is also an Appendix that contains additional information and a glossary of terms used throughout this course, so it is a good idea to keep it handy (maybe even open in a new tab) and reference it whenever you come across a new term in this course.

Assumptions

Tweets

Whenever we refer to getting ‘Tweets’ using the Twitter API, we refer to only those Tweets that are publicly available. The Twitter API does not provide Tweet information for Tweets that have been deleted, and does not provide Tweets from users who have made their Tweets private.

V2 Only

We will only be using the new Twitter API v2 and not the old API (v1.1). To learn more about the Twitter API v2, check out this technical overview of the Twitter API v2.

Let us start with module 1, that provides an introduction to Twitter API and examples of research with it.

Get Started

More Repositories

1

Twitter-API-v2-sample-code

Sample code for the Twitter API v2 endpoints
JavaScript
2,444
star
2

twitter-api-typescript-sdk

A TypeScript SDK for the Twitter API
TypeScript
927
star
3

search-tweets-python

Python client for the Twitter 'search Tweets' and 'count Tweets' endpoints (v2/Labs/premium/enterprise). Now supports Twitter API v2 /recent and /all search endpoints.
Python
841
star
4

twitter-api-java-sdk

A Java SDK for the Twitter API
Java
228
star
5

postman-twitter-api

Postman Collection for the Twitter API v2
203
star
6

cards-player-samples

Sample Code for Player Cards, both for stored and streamed video.
HTML
195
star
7

Gnip-Trend-Detection

Trend detection algorithms for Twitter time series data
Python
189
star
8

twitter-python-ads-sdk

A Twitter supported and maintained Ads API SDK for Python.
Python
185
star
9

account-activity-dashboard

Sample web app and helper scripts to get started with the premium Account Activity API
JavaScript
169
star
10

autohook

Automatically setup and serve webhooks for the Twitter Account Activity API
JavaScript
152
star
11

twitter-for-bigquery

Simplest way to get Tweets into BigQuery. Uses Google Cloud & App Engine, as well as Python and D3.
Python
141
star
12

large-video-upload-python

Sample Python code for uploading video up to 140 seconds and/or up to 512Mb.
Python
125
star
13

do_more_with_twitter_data

Tutorials for getting the most out of Twitter data.
Makefile
102
star
14

bookmarks-to-notion

A sample app that exports your bookmarks to a Notion page
Python
89
star
15

real-time-tweet-streamer

JavaScript
79
star
16

SnowBotDev

An example #TwitterBot illustrating the Twitter Account Activity and Direct Message APIs.
Ruby
79
star
17

twitter-webhook-boilerplate-node

A simple Node.js app using Express 4 for Twitter DMs and webhooks.
JavaScript
71
star
18

twitter-ruby-ads-sdk

A Twitter supported and maintained Ads API SDK for Ruby.
Ruby
66
star
19

FactualCat-Twitter-Bot

A Twitter bot example using the v2 manage Tweets functionality
Python
60
star
20

tweet_parser

Reliably parse Tweets delivered by Twitter Data products in both the activity-streams and original formats.
Python
53
star
21

search-tweets-ruby

Ruby client for the Twitter search endpoints (v2/Labs/premium/enterprise). Now supports Twitter API v2 /recent and /all search endpoints.
Ruby
53
star
22

bookmarks-search

Search your Twitter Bookmarks
JavaScript
50
star
23

postman-twitter-ads-api

Postman collection for the Twitter Ads API
JavaScript
46
star
24

chrome-extension-collections

Chrome extension for reporters to organize tweets and oEmbed them into their CMS system.
JavaScript
43
star
25

tweet-search

Sample code showing Tweet activity volume using Twitter's Enterprise full-archive search API. Built with Django, Tweet embeds and C3.
JavaScript
42
star
26

open-evolution

Open evolution proposals for the Twitter API
42
star
27

node-timeline-visualizations

Interactive timeline of when your friends joined Twitter. Uses Node.js, twit and vis.js.
JavaScript
37
star
28

remote-dev-jobs-streamer

Match Tweets containing remote developer jobs using Filtered Stream and Tweet Annotations
JavaScript
37
star
29

tweet-updates

This repository contains information about the 2017 updates to Tweet formats for attachments and simplified replies.
HTML
34
star
30

ruby-app-tweetmap

Simple Ruby app to read Twitter stream and map geo-tweets on a Google Map.
Ruby
33
star
31

spotatweet

A Spotify & Twitter API mashup showing what people are listening to now. Written in Node.js.
JavaScript
32
star
32

Gnip-Insights-Interface

Interface to Twitter's Engagement API
Python
31
star
33

twitter-context-annotations

Flat files containing available context annotation entities.
30
star
34

labs-sample-code

Sample code for Twitter Developer Labs
JavaScript
25
star
35

oauth2.0-bot

Sample code for creating a bot with OAuth 2.0 Authorization Code Flow with PKCE and V2 of the Twitter API.
Python
23
star
36

extract-usernames-from-tweet-replies

Python script to pull replies to a specific Tweet and extract user mentions
Python
23
star
37

ios-conversation-id-sample

Easily read recent public threads
Swift
22
star
38

tweet-notifier

A serverless app on AWS that gets Tweets of interest and publishes those to Slack, Amazon Chime & via Twilio SMS
Java
21
star
39

engagement-api-client-ruby

This example Engagement API Client helps manage the process of generating engagement metadata for large Tweet collections.
Ruby
21
star
40

weekly-tweet-sentiment

A tutorial which walks you through how you can create code that pulls your Tweets from the past 7 days and gives you a score to let you know exactly how your week has been.
Jupyter Notebook
21
star
41

web-recipes

Recipes to build #hashtag campaigns, Tweet intents and other experiences using Twitter for Web.
JavaScript
20
star
42

streaming-demos-node

Basic demos using Twitter streaming APIs with sample/filter streams. Built with node.js.
JavaScript
19
star
43

twitter-streaming-framework

TypeScript/Node.js framework for processing Twitter data stream.
TypeScript
18
star
44

Twitter-API-to-Google-Sheets

A code sample that allows you to send a payload from the Twitter API to Google Sheets.
Jupyter Notebook
16
star
45

account-activity-dashboard-enterprise

Sample web app and helper scripts to get started with the enterprise Account Activity API
JavaScript
14
star
46

Bookmarks-Notion-Notebook

Jupyter Notebook
14
star
47

gcloud-toolkit-recent-search

JavaScript
14
star
48

spaces-reach

A template app to show you how to get started with the Twitter Spaces API endpoints
JavaScript
14
star
49

compliant-client

A set of Python scripts for the Tweet and User batch compliance endpoints. Includes an app that manages it all in one go.
Python
14
star
50

enterprise-scripts-python

Sample Python scripts to help get started with the Twitter Enterprise APIs
Python
13
star
51

chrome-extension-tweetbar

Chrome Extension to add sidebar of Tweets to Youtube.
JavaScript
13
star
52

5-ways-to-convert-json-to-csv

JavaScript
12
star
53

.github

TwitterDev GitHub Organization-wide files
12
star
54

bot-profile-append

A Python script to help you add user attributions to your Twitter bots
Python
11
star
55

Gnip-Analysis-Pipeline

A processing pipeline for JSON-formatted Tweet data, such as that returned by Twitter APIs.
Python
11
star
56

parking

Jupyter Notebook
10
star
57

gcloud-toolkit-filtered-stream

Google Cloud Toolkit for the Filtered Stream API
JavaScript
10
star
58

ETL

An example app demonstrating storing Tweets in a Google Spreadsheet
TypeScript
9
star
59

dog-facts

A repository of sample code designed to help you Tweet random dog facts
Python
9
star
60

remote-dev-jobs-analytics

Learn 5 must know things about remote developer jobs posts on Twitter
JavaScript
9
star
61

twitter-aws-samples

Sample scripts for Twitter data processing and storage on AWS
Python
9
star
62

live-leaderboard

This Flask app listens for incoming scores via Twitter Direct Messages, ranks them, and Tweets the rankings.
Python
9
star
63

gcloud-toolkit-power-track

Google Cloud Toolkit for Twitter Enterprise - PowerTrack API
JavaScript
9
star
64

micpic

Easily stan your favorite K-pop stars via an iOS 14 widget
Swift
8
star
65

export-bookmarks

Export your Bookmarked Tweets with Flask
Python
8
star
66

twitter-alexa-skill-apl

A sample Alexa skill that brings the Twitter experience to Alexa Devices that support APL. For multimodal devices, you can see Tweets about a certain topic, or trends for a city.
Java
8
star
67

Pull-Tweet-Annotations-data-for-Twitter-profiles

Python code to identify most common topics mentioned by a Twitter profile, using Tweet Annotations and Recent Search API
Python
7
star
68

search-tweets-python-in-r

Running the Python library search-tweets-python in R
R
6
star
69

Tweet-Annotations

App to demo various features and functionality powered by Tweet Annotations and the Twitter API v2
Python
6
star
70

covid19-helper

Chatbot template to help developer direct users towards useful COVID-19 resources in their own language.
JavaScript
6
star
71

cat-pics

Resources for Tweeting cat pictures.
Python
5
star
72

noun-verb

A bot that Tweets noun/verb pairings
Python
4
star
73

Gnip-Tweet-Evaluation

Python
4
star
74

mytwitterjam

Create a Spotify Playlist from songs shared on Twitter
JavaScript
4
star
75

make-music-together

Code for Jessica Garson's PyCon talk on making music with SuperCollider, FoxDot and Python.
Python
4
star
76

ruby-enterprise-scripts

Sample Ruby scripts for using the Twitter Enterprise APIs
Ruby
3
star
77

analytics-tag-check

Chrome extension to check for proper installation of Twitter Conversion Tracking tags
JavaScript
3
star
78

getting-started-with-r

Sample code for a blog post about how to use R with the Twitter API. Uses the rtweet library
R
3
star
79

twitter-full-archive-search-ui

React based UI integrated to full archive search API
JavaScript
3
star
80

serverless-flow-framework

Run and scale realtime data analysis flows on serverless infrastructure
TypeScript
3
star
81

gnip-python-sdk

Simple wrapper around Gnip Search API in Python.
Python
3
star
82

getting-started-with-dash

Getting started with data visualization with Dash and recent search counts
Python
2
star
83

run-your-favorite-python-package-in-r

An example of how to call a the Twitter API from a Python package inside of R.
R
2
star
84

engagement-api-explorer

A fun way to explore metrics for your Tweets or for the public conversation
JavaScript
2
star
85

hashtag-graph-viz

Example graph vizualisations for Mozfest 2022
Jupyter Notebook
2
star
86

Gnip-Analysis-Tools

Python
1
star
87

cashtag-counts

Jupyter Notebook
1
star
88

twitter-enterprise-gcp

Enterprise API usage examples on Google Cloud Platform
JavaScript
1
star
89

Plot-Bookmarks

Plot your Bookmarks with Python
Python
1
star
90

JSON-to-CSV-livestream

Jupyter Notebook
1
star
91

Code-from-TwitterDev-Twitch-streams

Sample code from @TwitterDev Twitch streams
Python
1
star
92

Gnip-Filter-Optimization

Tools for optimizing Gnip PowerTrack rules and other downstream filters
Python
1
star
93

aws-toolkit-recent-search

Python
1
star
94

TwitterDev-live-streams

Code from live streams
Python
1
star
95

sports-coach

An example app showing how to use the Hide Replies API to keep conversations on topic.
JavaScript
1
star