I use my own aur script - the option that checks for updates (but does not install them) just does the following:[...]
I am doing something similar with a bash script.
But instead of downloading the AUR web page, I am reading the JSON from https://aur.archlinux.org/rpc.php with jshon.
With my slow connection this makes a big difference.
It is something like this (actual code on github)
for pkg in "$@"; do
args+='&arg[]='"$pkg"
done
json="$( wget "https://aur.archlinux.org/rpc.php?type=multiinfo${args}" -o /dev/null -O - )"
exec 3< <( jshon <<<"$json" -e results -a -e Name -u )
exec 4< <( jshon <<<"$json" -e results -a -e Version -u )
declare -A aurversion
while read name <&3 && read version <&4; do
aurversion["$name"]="$version"
done
exec 3<&- 4<&-
echo "${aurversion[@]}"
#code to compare and print
pacman -Qm | while read line; do
pkg=${line% *}
local_ver=${line#* }
aur_ver=$(lynx -dump -width 1024 -nolist \
"https://aur.archlinux.org/packages.php?SeB=x&K=$pkg" |
awk '/'$pkg'/ { print $3; }')
# your code here to compare local_ver to aur_ver and print any display you'd like
done
#!/bin/bash
# Check for AUR updates and Aurphans
aurfile=$(mktemp -t aurupdates.XXXXXX)
orpfile=$(mktemp -t aurphans.XXXXXX)
# remove old files
[[ ( -e "$aurfile" && -e "$orpfile" ) ]] && rm /tmp/aur{phans,updates}*
# check for updates
/usr/bin/cower --color=never -u > "$aurfile"
/usr/bin/aurphan -a > "$orpfile"
Thank you,
]]>