I'm trying to use the rtweet package to get a list of followers from a public twitter account (for example comedian Arj Barker).
search_tweet works fine, but the get_followers returns nothing. Am I missing something?
code:
library(rtweet)
create_token(
app = "xxxxx",
consumer_key = "xxxxxxxxxxxxxxxx",
consumer_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxx",
access_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
access_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
test <- search_tweets("@arjbarker", n= 10) #returns a 10 x 90 dataframe
test2 <- get_followers('arjbarker', n = 10) returns nothing.
Any idea what I'm doing wrong? I've tried with the user ID too, no luck. Is the function broken in the package?
Don't think the package/function is broken. Copy -pasting your code and adding my auth. keys worked.
library(rtweet)
create_token(
app = "***",
consumer_key = "***",
consumer_secret ="***" ,
access_token = "***" ,
access_secret = "***")
test <- search_tweets("@arjbarker", n= 10)
test2 <- get_followers('arjbarker', n = 10)
test3 <-as.data.frame(lookup_users(test2$user_id, parse = TRUE))
Here's what test2 looks like :
test2
# A tibble: 10 x 1
user_id
<chr>
1 777145663633125376
2 768214226934566912
3 1022674317677477888
4 301205593
5 2948044568
6 320741531
7 1438157028
8 1157280701328187392
9 749540126171148288
10 1002017666033270784
Maybe try adding "@" in username; I got same results:
> test2 <- get_followers('@arjbarker', n = 10)
> test2
# A tibble: 10 x 1
user_id
<chr>
1 777145663633125376
2 768214226934566912
3 1022674317677477888
4 301205593
5 2948044568
6 320741531
7 1438157028
8 1157280701328187392
9 749540126171148288
10 1002017666033270784