Tim Connors wrote:
On Thu, 10 Sep 2020, Trent W. Buck wrote:
One of the good folk of Debian Australia (I think
it was Paul Wise)
spotted that they now have a rain radar using OSM:
https://weather.bom.gov.au/location/r1r0fsn-melbourne
You need to enable first-party javascript to get ANY of content, not
just the map, but it's a lot closer to the old m.bom.gov.au than
anything else.
Also doesn't work in PrinceXML :-(
$ prince-browser --javascript
https://weather.bom.gov.au/
prince:
https://weather.bom.gov.au/:1: error: unexpected token
reserved("const")
prince:
https://weather.bom.gov.au/static/js/vendors~main.4319003d.chunk.js:1: error:
unexpected token identifier("patches")
prince:
https://weather.bom.gov.au/static/js/main.9384b51b.chunk.js:1: error:
unexpected token identifier("fetchParameters")
Management are pretty keen to get rid of everything that works on the old
website too.
Because "monetize or GTFO"?
I was slightly annoyed how it took 1 second to
download all the gifs on my
50mbit/s connection, so I discovered that debian's `puf` has a largely
wget compatible syntax (and I didn't have to work out how to fork off
dozens of python subprocesses and wait for them all). Now gm is by far
the slowest invocation:
You could just do C in python:
for i in range(60):
if 0 == os.fork():
os.execvp('wget', f'...{i}.webp')
os.wait()
This makes the interpreter slightly pissy, but for something this simple, will work.
The next layer up is to do basically the same thing with green threads (which makes all
the non-fluids bindings cry).
The full-blown Stockholm Syndrome version is the twisted framework, with all the class
shit.
Or if you're on 3.something, something something asyncio.
subprocess.call([
- 'wget', '-nv', '-P', tempdir_path,
- '--',
+ 'puf', '-P', tempdir_path,
# Try to get a rain image for every minute in the last hour.
# 1 in every 6 will work. For now, just ignore that some fail.
# FIXME: this is VERY VERY VERY slow to download.
I did consider wget2 --http2-request-window:
Set maximum number of parallel streams per HTTP/2 connection (default: 30).
except of course bom's main site is not even TLS, let alone SPDY.
Mandatory javascript w/o even TLS was what finally made me annoyed
enough to write the first version of that script.
Remember kids: "javascript" and "postscript" are just fancy brand
names for "arbitrary code execution"!