ZG has started publishing data via https://raw.githubusercontent.com/statzg/glibraries-stat-zug/master/daten/result-themen-14-03-01.csv. This also includes a timestamp.
Don't know when it has exactly been done but data is already recovered from CSV file at given URL
@LuluTchab but currently the CSV is fetched from the website instead of the given URL. Or am I missing something?
Here's the output of the script:
./scrape_zg.py
ZG
Downloading: https://www.zg.ch/behoerden/gesundheitsdirektion/amt-fuer-gesundheit/corona
Scraped at: 2020-04-23T07:56:49.131242+02:00
Downloading: https://www.zg.ch/behoerden/gesundheitsdirektion/statistikfachstelle/themen/gesundheit/corona
Downloading: https://raw.githubusercontent.com/statzg/glibraries-stat-zug/master/daten/result-themen-14-03-01.csv
Scraped at: 2020-04-23T07:56:49.651447+02:00
Date and time: 22.04.2020
Confirmed cases: 176
Hospitalized: 6
ICU: 3
Recovered: 131
Deaths: 8
It needs 3 steps to "find" the correct URL for the CSV file (URL like the one given in the issue description). So this URL is used to parse data. But, if the URL never changes, scraper could be improved to directly try to recover data instead of recovering it by downloading 2 others pages. It is maybe what was the issue creator suggesting, I don't know.
But, if they decide to change the URL, to avoid any surprise in the future, we could let the code as it is now, I let you choose.
I was in contact with ZG and they confirmed that the URL would be stable, therefore I think it would be the better option to directly access https://raw.githubusercontent.com/statzg/glibraries-stat-zug/master/daten/result-themen-14-03-01.csv @metaodi, up to you?
However, what needs to be updated is the source printed by the scraper. Currently, not all data can be found, source printed should be https://www.zg.ch/behoerden/gesundheitsdirektion/statistikfachstelle/themen/gesundheit/corona
Okay got it, I will update the scraper.