Reputation: 53
I am working in R with the twitteR
package, which is meant to get information from Twitter through their API. After getting authentificated, I can download information about any user with the getUser
function. However, I am not able to do so with usernames which are only numbers (for example, 1234). With the line getUser("1234")
I get the following error message:
Error in twInterfaceObj$doAPICall(paste("users", "show", sep = "/"), params = params, : Not Found (HTTP 404).
Is there any way to get user information when the username is made completely of numbers? The function tries to search by ID instead of screenname when it finds only numbers.
Thanks in advance!
Upvotes: 2
Views: 500
Reputation:
First of all, twitteR is deprecated in favour of rtweet, so you might want to look into that.
The specific user ID you've provided is a protected account, so unless your account follows it / has access to it, you will not be able to query it anyway.
Using rtweet and some random attempts to find a valid numerical user ID, I succeeded with this:
library(rtweet)
users <- c("989", "andypiper")
usr_df <- lookup_users(users)
usr_df
rtweet also has some useful coercion functions to force the use of screenname or ID (as_screenname
and as_userid
respectively)
Upvotes: 1