From 4beafd233d42a22b0c1c2c6ac56beda412bb4ada Mon Sep 17 00:00:00 2001 From: JulioV Date: Thu, 22 Apr 2021 14:28:52 -0400 Subject: [PATCH] Fix crash when scraping data for an app that does not exist --- docs/change-log.md | 4 ++++ src/data/application_categories.R | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/change-log.md b/docs/change-log.md index 141c3da3..68b46ef6 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,5 +1,9 @@ # Change Log +## v1.1.1 (in-progress) +- Fix length of periodic segments on days with DLS +- Fix crash when scraping data for an app that does not exist +- Add tests for phone screen data ## v1.1.0 - Add Fitbit calories intraday features ## v1.0.1 diff --git a/src/data/application_categories.R b/src/data/application_categories.R index 55d8f66b..b9fa35ef 100644 --- a/src/data/application_categories.R +++ b/src/data/application_categories.R @@ -12,9 +12,7 @@ get_genre <- function(apps){ for(i in seq_along(urls)){ try_download <- try(download.file(urls[i], destfiles[i], quiet=TRUE), silent = T) - page_title <- read_html(destfiles[i]) %>% html_nodes("title") %>% html_text() - - if(is(try_download,"try-error") || page_title == "Not Found"){ + if(is(try_download,"try-error") || (read_html(destfiles[i]) %>% html_nodes("title") %>% html_text()) == "Not Found"){ genres[i] <- "unknown" } else{