Created
June 25, 2020 15:12
-
-
Save DominikVogel/6ed792bac3d7eb6c22cca8d1ce94ec2d to your computer and use it in GitHub Desktop.
Use specific rtweet token / use token with RScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rtweet tries to automatically detect a token for the Twitter API | |
# This fails when you run the script from the command line with RScript | |
# If you have multiple tokens, this script also helps selecting the right token | |
# Code inspired by https://github.com/samzipper/SkeeterStream/blob/master/TestLookupUsers.R | |
# Requirements: | |
# You need to have set up a token with rtweet | |
# More info: https://rtweet.info/articles/auth.html | |
# Assumption token is stored at /home/username/ | |
library(rtweet) | |
# read in token which was already created | |
rtoken <- readRDS(file.path(path.expand("~/"), | |
".rtweet_token.rds")) | |
# search twitter! | |
tweets <- search_tweets("@BarackObama", | |
n = 25, | |
type = "recent", | |
include_rts = FALSE, | |
retryOnRateLimit = TRUE, | |
token = rtoken) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment