So , Linux .. I don’t see a reason why not on MacOS.
As general this is simple bash/sh loop , the “magical“ part is == grep -oP '(?<=href=")[^"]*' == , so if any Windows ninja can contribute and translate it to powershell or whatever I guess a lot of people will appreciate it .
MikroTik's download URLs follow a known scheme for downloading packages. So no need for grep'ing the HTML, since you can just replace the version and architecture in the URL.
Similar with a "stable" or any channel, you can use awk and the .../
which gets "7.21beta8", and that can be used in the direct URL. And once you've downloaded the historic packages, you can just cron or similar to schedule checking the .../NEWESTa7. to update your archive.
So I'm not sure scraping the HTML is needed, outside finding older versions.
Not only well known but scripts to do that by simply type arch/version exsits from years.
However you need to know 2 thinks , arch and version .. In my case I just do that 2 -3 times per year regarldes of both can get all lates and grates (including change logs, winbox, swith os etc.. ) IMO no one need to do this execept if want to have offiline copy when own multiple different arch. devices (think on it as similar to have linux distro offline/local mirror pkg repo)
Intresting is this NEWESTa7.testing file have aways same name ?
Yes, the URL only changes the .testing part, to .stable, etc., which is the "channel" name provided after the . extension.
It also returns the build number, separated by space, which is why the awk is needed to get the just the version number needed build the actual download URLs.
There is similar URL for WinBox, curl -s https://upgrade.mikrotik.com/routeros/winbox/LATEST.4 that return the current version.
Now the URL have changed in past, but since RouterOS (and WinBox) use these URL to do their update checks, there is always a URL to get version
#!/bin/bash
ARCH=('-arm' '-arm64' '-mipsbe' '-mmips' '-smips' '-tile' '-ppc' '')
VERSION=('6' '7' 'a7')
RELEASE=('long-term' 'stable' 'testing' 'development')
echo Mikrotik Versions of RouterOS/Firmware.
for arch in "${ARCH[@]}"
do
for ver in "${VERSION[@]}"
do
echo Ver ${ver}
for rel in "${RELEASE[@]}"
do
version=$(curl -s http://upgrade.mikrotik.com/routeros/NEWEST${ver}.${rel} | cut -f1 -d' ')
echo ${arch:1} ${rel} https://download.mikrotik.com/routeros/${version}/routeros-${version}${arch}.npk
done
done
done
echo