X-Git-Url: https://git.xandkar.net/?p=covid-19-scrapers.git;a=blobdiff_plain;f=fetch-case-count-usa-ny;h=c50288cf0e38e9853696bac9cc6fb018414329fe;hp=95a039f1f12a9909288c28c721a5f4d05cc026b7;hb=acd2abc3d867820c89d09d2fd1361c4046a71c4e;hpb=0b60ba947fe0490f018137cbb9c51b01bdcb8b39 diff --git a/fetch-case-count-usa-ny b/fetch-case-count-usa-ny index 95a039f..c50288c 100755 --- a/fetch-case-count-usa-ny +++ b/fetch-case-count-usa-ny @@ -16,6 +16,8 @@ VALID_LOCATIONS=' Monroe Montgomery Nassau + New York City: + New York State (Outside of NYC) Orange Putnam Rockland @@ -24,11 +26,9 @@ VALID_LOCATIONS=' Suffolk Tioga Tompkins + Total Positive Cases (Statewide) Ulster Westchester - New York State (Outside of NYC) - New York City: - Total Positive Cases (Statewide) ' DEFAULT_LOCATION='New York City:' @@ -50,6 +50,14 @@ esac curl 'https://health.ny.gov/diseases/communicable/coronavirus/' \ | 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" + } + /^[\(\)]/ { update_node() next @@ -64,12 +72,12 @@ curl 'https://health.ny.gov/diseases/communicable/coronavirus/' \ XmlPayload = substr($0, 2, length($0)) } - XmlPath == "/html/body/div/div/div/div/div/div/table/tr/td" && XmlPayload == location { + XmlPath == target_path && XmlPayload == location { found = 1; next } - XmlPath == "/html/body/div/div/div/div/div/div/table/tr/td" && found { + XmlPath == target_path && found { print XmlPayload; found = 0; next;