Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sevetseh28 opened this issue Nov 5, 2018 · 4 comments

Comments

@sevetseh28
Copy link

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
Copy link
Author

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!

@Hawkeye407
Copy link

Hawkeye407 commented Nov 5, 2018

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.

@sevetseh28
Copy link
Author

sevetseh28 commented Nov 5, 2018

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!

@Jupaoqq
Copy link

Jupaoqq commented Jun 19, 2019

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants