mkearney / tweetbotornot

🤖 R package for detecting Twitter bots via machine learning
https://tweetbotornot.mikewk.com
Other
388 stars 136 forks source link

Fix when fast = TRUE only able to check 180 users per 15 min, not 90000 users #29

Open Jupaoqq opened 5 years ago

Jupaoqq commented 5 years ago

This proposed change will fix the issues mentioned in issue #23 and #24, which is even with the fast argument on, this API could only check 180 users per 15 minutes, instead of 90000 users per 15 minutes. With this fix, this API is able to check 90000 users per 15 minutes.

in line 89 to 96 of tweetbotornot/R/tweetbotornot.R

I changed

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) }

so that it only takes user-level data if fast argument is on, without looking at user's timeline which only has a rate limit of 180 users / 15 minutes.