even more error handling
This commit is contained in:
@@ -59,6 +59,14 @@ for(a in 1:nrow(acc_df)) {
|
|||||||
current <- twitter_api_call(api_url, query, api_params)
|
current <- twitter_api_call(api_url, query, api_params)
|
||||||
tweets_temp <- fromJSON(correctJSON(current))
|
tweets_temp <- fromJSON(correctJSON(current))
|
||||||
|
|
||||||
|
status <- length(tweets_temp)
|
||||||
|
if(status == 0) {
|
||||||
|
cat("[WARNING] Empty API result. Trying again.\n")
|
||||||
|
rm(tweets_temp)
|
||||||
|
Sys.sleep(2)
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
# Check if API output contains error fields
|
# Check if API output contains error fields
|
||||||
status <- "error" %in% names(tweets_temp)
|
status <- "error" %in% names(tweets_temp)
|
||||||
if(status) {
|
if(status) {
|
||||||
|
|||||||
+2613
-269
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user