Fix crash when scraping data for an app that does not exist

pull/134/head
JulioV 2021-04-22 14:28:52 -04:00
parent ea8094e028
commit 4beafd233d
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,9 @@
# Change Log # 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 ## v1.1.0
- Add Fitbit calories intraday features - Add Fitbit calories intraday features
## v1.0.1 ## v1.0.1

View File

@ -12,9 +12,7 @@ get_genre <- function(apps){
for(i in seq_along(urls)){ for(i in seq_along(urls)){
try_download <- try(download.file(urls[i], destfiles[i], quiet=TRUE), silent = T) 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") || (read_html(destfiles[i]) %>% html_nodes("title") %>% html_text()) == "Not Found"){
if(is(try_download,"try-error") || page_title == "Not Found"){
genres[i] <- "unknown" genres[i] <- "unknown"
} }
else{ else{