From fb902f7b3677c84919e8776bda3890f861703568 Mon Sep 17 00:00:00 2001 From: FilipeamTeixeira Date: Thu, 12 Sep 2024 15:29:02 +0200 Subject: [PATCH] reduced download_t100 download time --- R/download_t100.R | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/R/download_t100.R b/R/download_t100.R index a8160df..d8be90a 100644 --- a/R/download_t100.R +++ b/R/download_t100.R @@ -33,8 +33,8 @@ download_t100 <- function(y = NULL, type = NULL){ followlocation = TRUE, autoreferer = TRUE, curl = curl) message("Connecting to T100") - html <- getURL('https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%20Pn44vr45', curl = curl) - temp <- GET('https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%20Pn44vr45', curl = curl) + #html <- getURL('https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%20Pn44vr45', curl = curl) + html <- GET('https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%20Pn44vr45', curl = curl) message("Done") viewstate <- as.character(sub('.*id="__VIEWSTATE" value="([0-9a-zA-Z+/=]*).*', '\\1', html)) @@ -94,13 +94,12 @@ download_t100 <- function(y = NULL, type = NULL){ followlocation = TRUE, autoreferer = TRUE, curl = curl) message("Connecting to T100") - html <- getURL("https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4%25Pn44vr45", curl = curl) - temp <- GET("https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4%25Pn44vr45", curl = curl) + #html <- getURL("https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4%25Pn44vr45", curl = curl) + html <- GET("https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4%25Pn44vr45", curl = curl) message("Done") viewstate <- as.character(sub('.*id="__VIEWSTATE" value="([0-9a-zA-Z+/=]*).*', '\\1', html)) viewstategenerator <- as.character(sub('.*id="__VIEWSTATEGENERATOR" value="([0-9a-zA-Z+/=]*).*', '\\1', html)) - eventvalidation <- as.character(sub('.*id="__EVENTVALIDATION" value="([0-9a-zA-Z+/=]*).*', '\\1', html)) message("Downloading file")