Created
December 2, 2020 04:16
-
-
Save gadenbuie/33c350458305f4423f30c1274be63b34 to your computer and use it in GitHub Desktop.
This file contains 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
library(rtweet) | |
last_tweet_id <- "1333907891049402371" | |
lookup_thread <- function(status_id, tweets = NULL) { | |
tweet <- rtweet::lookup_tweets(status_id) | |
tweets <- dplyr::bind_rows(tweet, tweets) | |
if (is.na(tweet$reply_to_status_id)) { | |
return(tweets) | |
} else { | |
lookup_thread(tweet$reply_to_status_id, tweets) | |
} | |
} | |
# gather from last tweet to first tweet in the thread, | |
# following the trail of reply_to_status_id | |
thread <- lookup_thread(last_tweet_id) | |
# https://git.io/JITyy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment