tweetbotornot icon indicating copy to clipboard operation
tweetbotornot copied to clipboard

Warning: /1.1/statuses/user_timeline.json - Not authorized. when using Fast mode

Open sevetseh28 opened this issue 6 years ago • 4 comments

Hi! I'm getting this error from the Twitter API: Warning: /1.1/statuses/user_timeline.json - Not authorized.

Im calling the script with the Fast parameter set to true, so it shouldn't get the user's timeline, right? data <- tweetbotornot(users, fast=TRUE)

sevetseh28 avatar Nov 05 '18 15:11 sevetseh28

I think the issue lies on this part of the code: image

it's getting the most recent 100 tweets without taking into account the fast parameter!

sevetseh28 avatar Nov 05 '18 16:11 sevetseh28

Hi, I have the same problem, I think that the reason for the error is that you exceed twitter API. I am using FAST parameter too and in the documentation is that you can call 90 000 calls... but it's not working for me, my limit with FAST parameter is 180, same without.

In my case error looks like:

Warning: /1.1/statuses/user_timeline.json - Not authorized. Warning: /1.1/statuses/user_timeline.json - Not authorized. Warning: /1.1/statuses/user_timeline.json - Not authorized. Warning: /1.1/statuses/user_timeline.json - Not authorized. Warning: Rate limit exceeded - 88 Error in if (n%/%200 < n.times) { : argument is of length zero

My theory is that during the analyze I reach API limit.

Hawkeye407 avatar Nov 05 '18 16:11 Hawkeye407

Clearly, the problem is that the script is not considering the FAST param at all. You can see that it is getting the user's timelime (/1.1/statuses/user_timeline.json endpoint is the user's timeline). image

botornot should receive fast = fast I guess, Im not an expert in R though.

Anyway, I have already tried hardcoding the default parameter to TRUE but I'm getting another error: Error: Columns `user_id`, `screen_name` not found Call `rlang::last_error()` to see a backtrace

Output of summary(rlang::last_error()):

<error>
message: Columns `user_id`, `screen_name` not found
class:   `rlang_error`
fields:  `message`, `trace` and `parent`
backtrace:
x
\-tweetbotornot::tweetbotornot(users, fast = TRUE)
  +-tweetbotornot::botornot(x, fast = TRUE)
  \-tweetbotornot:::botornot.character(x, fast = TRUE)
    +-tweetbotornot::botornot(x, fast = fast)
    \-tweetbotornot:::botornot.data.frame(x, fast = fast)
      +-base::unique(x[, c("user_id", "screen_name")])
      +-x[, c("user_id", "screen_name")]
      \-tibble:::`[.tbl_df`(x, , c("user_id", "screen_name"))
        +-tibble:::check_names_df(j, x)
        \-tibble:::check_names_df.character(j, x)
          \-tibble:::check_names_before_after.character(j, names(x))
            \-tibble:::stopc(pluralise_msg("Column(s) ", unknown_names), " not found")

@mkearney could you give us a hand here?? Thank you!

sevetseh28 avatar Nov 05 '18 17:11 sevetseh28

@sevetseh28 @Hawkeye407

  1. delete this package (tweetbotornot) from your R packages library
  2. Fork this Repo
  3. in (whatever your github username is)/tweetbotornot/R/tweetbotornot.R, in line 89 to 96, change

botornot.character <- function(x, fast = FALSE) { x <- x[!is.na(x) & !duplicated(x)] x <- rtweet::get_timelines(x, n = 100) botornot(x, fast = fast) }

to

botornot.character <- function(x, fast = FALSE) { x <- x[!is.na(x) & !duplicated(x)] if (fast) { x <- rtweet::lookup_users(x) } else { x <- rtweet::get_timelines(x, n = 100) } botornot(x, fast = fast) }

  1. commit those changes
  2. open a R session, then do

library(devtools) install_github("(whatever your github username is)/tweetbotornot", dependencies = TRUE)

  1. Run your R script

I've also opened a pull request to make those changes to this repo to fix this issue.

Jupaoqq avatar Jun 19 '19 14:06 Jupaoqq