Closed artfulrobot closed 1 month ago
Rather than scrape the website, you'd be better off parsing the data from either https://nodejs.org/download/release/index.json or https://nodejs.org/download/release/index.tab.
@richardlau thanks for the links, this seems to work:
curl -s 'https://nodejs.org/download/release/index.json' | jq -c 'map(select(.lts)) []| {date, version}' | sort | tail -n1 | jq '.version'
Details
For years I've been scraping nodejs.org/en, using a simple xpath
'//a[contains(@title, "LTS")]/@data-version'
to find the latest LTS version.From there I could download and install it within my bash script.
Now the homepage has changed has removed any semantic data, so I can't find the latest LTS.
My script did this:
Node.js version
Not applicable.
Example code
No response
Operating system
linux
Scope
Installation?
Module and version
Not applicable.