Update-check script stalls on the AUR page - how do you batch it?

I keep a small script that runs nightly and diffs the installed AUR packages against their upstream pages, so that in the morning I have a list instead of a browser session with thirty tabs. Nothing fancy: read pacman -Qm, request each package page, compare version strings, write a report.

Since last week the report comes back mostly empty, and the pages that do come back are challenge pages. Not an HTTP error - a 200 with the widget in it. The fetch loop parses titles out of HTML and so it just finds nothing, records “no change”, and moves on. It took me two days to notice, because the “nothing changed” line looks exactly like a good night.

Two things I want to fix, and one I would like advice on:

  1. Detection. I am adding a check on the response against a marker only the challenge page has. Cheap and stops the silent case.
  2. The unblock. The widget is reCAPTCHA v2; the token field is g-recaptcha-response and it is single use with a short life. Minting it outside a browser is two HTTP calls (create task with the sitekey, poll until the answer arrives), and the token has to be used before roughly two minutes are up. That second point shapes the loop: token, then request immediately, never token, then wait.
  3. Advice. Is there a mirror or an API for AUR metadata that does not put a captcha in front of the page, so I can drop the HTML parsing altogether? aurweb has an RPC endpoint, but the version is not in the payload for every package, which is why I went to the page in the first place.

Failing that, is a per-run token budget sane? I was going to cap it at 10 solves a night (a tenth of a cent at NeuroCaptcha rates, which is nothing) and let packages beyond that wait for the next run. Does anyone here run AUR checks at scale and does the RPC really lack the field, or am I just looking at the wrong endpoint?

You might want to take a look at these.

Very nice - I didn’t know about those - and I think I might be using something like this in the future:

curl https://aur.archlinux.org/packages-meta-v1.json.gz | gunzip | jq '.[] | .Name + ":" + .Version'  

which neatly gives output like

"010editor:17.0-1"
"02engine-bin:1.3.1-1"
"0ad-boongui:2.6.11-2"
"0ad-git:1:a26.r2110.g14a5ccee52-1"
"0ad-data-git:1:a26.r2110.g14a5ccee52-1"
"0ad-zh-lang:a27.0-2"
"0c-ime:0.2.13-1"
"0cc-famitracker:0.3.15.3-1"
...

Hopefully the OP finds it as useful as I do!

Same failure here after the last update, and the error message is misleading: the ping target itself answers, what fails is the whole check when it runs from a script rather than from the terminal. I wrapped pacman-mirrors in a timer so the mirror list gets refreshed before the nightly sync, and from cron the probe returned “no connection” on every mirror within seconds, while the same command typed by hand picked a mirror fine.

The difference turned out to be the shell environment, not the mirrors: the timer had no locale and no proxy variables, so the HTTP probe ran with an empty UA and got a challenge page instead of the mirror status. A response of 200 with a challenge page parses as “not a mirror”, which is why every entry scored as dead.

Two fixes that held up: pass a real user agent and an explicit --timeout so a challenge page is distinguishable from an unreachable host, and check the exit code rather than grepping the output. For the check itself a solving API such as the one we use returns the token so the probe sees the mirror list again.

Has anyone found the actual mirror-set change behind this, or is it just the probe being stricter?

Welcome to the forum! :waving_hand:

This is the official Manjaro support forum, we do not provide support for Arch, the AUR itself or Aurweb.

I suggest you create a topic on Arch’s forum, probably in the AUR Issues, Discussion & PKGBUILD Requests section.