add script to add 88x31s of all fedi accounts it follows that implement .well-known/button.json

This commit is contained in:
gnat 2024-11-25 01:20:14 -08:00
parent 37fe11059a
commit 46c24d03c8

7
scripts/add-following-88x31s Executable file
View File

@ -0,0 +1,7 @@
toot following 0x6e6174 | cut -d' ' -f2 | while read -r account; do
url="$(toot whois $account | grep -i site -A1 | grep -E 'https?://')/.well-known/button.json";
[ -n "${url}" ] && response="$(curl -s -o /dev/null -w '%{http_code}' "${url}")";
[ "$response" -eq "200" ] && body="$(curl -s "${url}" | jq -r '.default as $default | .buttons[] | select(.id == $default) | "<a href=\"\(.link)\" id=\"\(.id)\"><img src=\"\(.uri)\" alt=\"\(.alt)\"></a>"' 2>/dev/null)"
[ -n "${body}" ] && echo "${body}" > ./files/88x31/$(echo $url | sed 's/https:\/\///g; s/.well-known\/button.json//; s/\//-/g; s/.$//').html
body=''
done