cjbarrie / academictwitteR

Repo for academictwitteR package to query the Twitter Academic Research Product Track v2 API endpoint.
Other
272 stars 59 forks source link

[BUG] get_user_timeline inconsistently returns Error in make_query(url = endpoint_url, ...) something went wrong. Status code: 400 #348

Closed maria-pro closed 2 years ago

maria-pro commented 2 years ago

Please confirm the following

Describe the bug

Hi I am trying to use get_user_timeline() with my set of user that i got

data_tidy<-bind_tweets(data_path = "data", output_format = "tidy")
users<-as_tibble(unique(data_tidy$author_id))
users_short<-users$value

The same step runs with no issues one time or produces the error below. The step is:

user_timelines<-get_user_timeline(users_short[1201:1400],
                                  start_tweets = "2018-01-01T00:00:00Z",
                                  end_tweets = "2022-01-09T00:00:00Z",
                                  data_path = "user_timelines_new10__",
                                  n= Inf
)

The error I am getting from occasionally is:

Error in make_query(url = endpoint_url, params = params, bearer_token = bearer_token,  : 
  something went wrong. Status code: 400

No further details on what exactly is wrong...

When i split my batch and run it not in users_short[1201:1400] but it smaller batches it works (at times again with the same intermittent error).

How to fix this?

Thank you

Expected Behavior

to collect data as expected or at least provide more details on the error - i believe it is more likely Twitter API limitations related

Steps To Reproduce

users<-read_csv("https://raw.githubusercontent.com/maria-pro/daniel/main/users.csv")

users_short<-users$value

ser_timelines<-get_user_timeline(users_short[1201:1400], start_tweets = "2018-01-01T00:00:00Z", end_tweets = "2022-01-09T00:00:00Z", data_path = "user_timelines_new10__", n= Inf )

Environment

R version 4.2.0 (2022-04-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Monterey 12.2.1

Anything else?

No response