X-Git-Url: https://git.xandkar.net/?p=covid-19-scrapers.git;a=blobdiff_plain;f=fetch-case-count-usa-ny;h=e346935c14551c49381e5b8679d448a028e0a65f;hp=c50288cf0e38e9853696bac9cc6fb018414329fe;hb=d5c6a8b1018d19ec0f3d4ab8c7f57f17aa62e8d1;hpb=acd2abc3d867820c89d09d2fd1361c4046a71c4e diff --git a/fetch-case-count-usa-ny b/fetch-case-count-usa-ny index c50288c..e346935 100755 --- a/fetch-case-count-usa-ny +++ b/fetch-case-count-usa-ny @@ -5,9 +5,26 @@ # - awk # - hxpipe (packaged in html-xml-utils on Debian and Ubuntu) +# 2020-03-16 morning-afternoon +#URI='https://health.ny.gov/diseases/communicable/coronavirus/' +#TARGET_PATH='/html/body/div/div/div/div/div/div/table/tr/td' +#DEFAULT_LOCATION='New York City:' + +# 2020-03-16 late evening 22:30 +#URI='https://health.ny.gov/diseases/communicable/coronavirus/' +#TARGET_PATH='/html/body/div/div/div/div/div/div/tr/td' +#DEFAULT_LOCATION='New York City:' + +# 2020-03-17 late afternoon 16:35 +URI='https://coronavirus.health.ny.gov/county-county-breakdown-positive-cases' +TARGET_PATH='/html/body/div/div/main/div/div/div/div/div/div/div/div/table/tbody/tr/td' +DEFAULT_LOCATION='New York City' + VALID_LOCATIONS=' Albany + Allegany Broome + Clinton Delaware Dutchess Erie @@ -16,21 +33,25 @@ VALID_LOCATIONS=' Monroe Montgomery Nassau - New York City: + New York City New York State (Outside of NYC) + Onondaga + Ontario Orange Putnam + Rensselaer Rockland Saratoga Schenectady Suffolk + Sullivan Tioga Tompkins Total Positive Cases (Statewide) Ulster Westchester + Wyoming ' -DEFAULT_LOCATION='New York City:' usage() { printf "Usage: %s [LOCATION]\n" "$0" @@ -47,17 +68,12 @@ case "$1" in * ) location="$1";; esac -curl 'https://health.ny.gov/diseases/communicable/coronavirus/' \ +curl "$URI" \ | hxpipe \ -| awk -v location="$location" ' - BEGIN { - # 2020-03-16 morning-afternoon - #target_path = "/html/body/div/div/div/div/div/div/table/tr/td" - - # 2020-03-16 late evening 22:30 - target_path = "/html/body/div/div/div/div/div/div/tr/td" - } - +| awk \ + -v location="$location" \ + -v target_path="$TARGET_PATH" \ + ' /^[\(\)]/ { update_node() next