skip to Main Content

The answer to the question located here does not seem to work anymore: Obtaining twitter screen names from a twitter list

Does anyone know if the twitteR package has been changed since it was answered in 2015. If so, is there a way to download the members of a public list in the current version?

Here’s the previous answer’s code updated to include a current lists. Requires a Twitter API authorization. It now returns a list of length 0 when it should have a list of the 20 Premier League club names.

library(rjson)
library(httr)
library(twitteR)
twlist <- "premier-league-clubs"
twowner <- "TwitterUK"
api.url <- paste0("https://api.twitter.com/1.1/lists/members.json?slug=",
           twlist, "&owner_screen_name=", twowner, "&count=5000")
response <- POST(api.url, config(token=twitteR:::get_oauth_sig()))
response.list <- fromJSON(content(response, as = "text", encoding = "UTF-8"))
users.names <- sapply(response.list$users, function(i) i$name)
users.screennames <- sapply(response.list$users, function(i) i$screen_name)
head(users.names)

2

Answers


  1. The author of the package in his github account mentions that the twitteR package is deprecated in favor or rtweet. Probably you have to take a look to the documentation of the rtweet package.

    Login or Signup to reply.
  2. Swapping from POST to GET when making the request seems to work for lists I am retrieving.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search