Reorder license scrape operations.

This commit is contained in:
mattbk
2026-08-02 18:36:42 -05:00
parent bf9aa3fb24
commit 9bfd4a2bf2
+20 -15
View File
@@ -8,6 +8,7 @@ library(tidyr)
###### ARRL ###### ###### ARRL ######
arrl_url <- "https://www.arrl.org/fcc-license-counts" arrl_url <- "https://www.arrl.org/fcc-license-counts"
cat("Checking ARRL...")
# Read the page # Read the page
d_raw <- read_html(arrl_url) d_raw <- read_html(arrl_url)
@@ -51,6 +52,7 @@ write.table(tab, file = "out/arrl-fcc-licenses-scraped.csv", sep = ",",
###### HamCall ###### ###### HamCall ######
hamcall_url <- "https://hamcall.net/hamcallcounts.html" hamcall_url <- "https://hamcall.net/hamcallcounts.html"
cat("Checking HamCall...")
# Read the page # Read the page
hamcall_raw <- read_html(hamcall_url) hamcall_raw <- read_html(hamcall_url)
@@ -127,9 +129,26 @@ hamcall_table_state <- left_join(hamcall_table_state, state_codes, by = join_by(
relocate(Count, .after = f) %>% relocate(Count, .after = f) %>%
relocate(source_name:source_detail, .after = m) relocate(source_name:source_detail, .after = m)
##### Append tables #####
write.table(hamcall_table_class_pivot, file = "out/hamcall-licenses-scraped.csv", sep = ",",
append = TRUE, quote = FALSE,
col.names = F, row.names = FALSE,
na = "")
write.table(hamcall_table_city, file = "out/hamcall-cities-scraped.csv", sep = ",",
append = TRUE, quote = FALSE,
col.names = F, row.names = FALSE,
na = "")
write.table(hamcall_table_state, file = "out/hamcall-states-scraped.csv", sep = ",",
append = TRUE, quote = FALSE,
col.names = F, row.names = FALSE,
na = "")
###### AE7Q States ###### ###### AE7Q States ######
ae7q_url <- "https://www.ae7q.com/query/stat/LicenseUSA.php" ae7q_url <- "https://www.ae7q.com/query/stat/LicenseUSA.php"
cat("Checking AE7Q...")
# Read the page # Read the page
ae7q_raw <- read_html(ae7q_url) ae7q_raw <- read_html(ae7q_url)
@@ -168,6 +187,7 @@ ae7q_table_state <- ae7q_table_state_raw %>%
###### AE7Q License Actions ###### ###### AE7Q License Actions ######
ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=", Sys.Date()-1) ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=", Sys.Date()-1)
#ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=2024-11-01") #ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=2024-11-01")
cat("Checking AE7Q actions...")
# Read the page # Read the page
ae7q_new_raw <- read_html(ae7q_new_url) ae7q_new_raw <- read_html(ae7q_new_url)
@@ -211,21 +231,6 @@ ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=",
##### Append tables ##### ##### Append tables #####
write.table(hamcall_table_class_pivot, file = "out/hamcall-licenses-scraped.csv", sep = ",",
append = TRUE, quote = FALSE,
col.names = F, row.names = FALSE,
na = "")
write.table(hamcall_table_city, file = "out/hamcall-cities-scraped.csv", sep = ",",
append = TRUE, quote = FALSE,
col.names = F, row.names = FALSE,
na = "")
write.table(hamcall_table_state, file = "out/hamcall-states-scraped.csv", sep = ",",
append = TRUE, quote = FALSE,
col.names = F, row.names = FALSE,
na = "")
write.table(ae7q_table_state, file = "out/ae7q-states-scraped.csv", sep = ",", write.table(ae7q_table_state, file = "out/ae7q-states-scraped.csv", sep = ",",
append = TRUE, quote = FALSE, append = TRUE, quote = FALSE,
col.names = F, row.names = FALSE, col.names = F, row.names = FALSE,