Skip to content

Instantly share code, notes, and snippets.

@noellabo
Last active January 31, 2021 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noellabo/02637a326829534f4a2965ab7227b422 to your computer and use it in GitHub Desktop.
Save noellabo/02637a326829534f4a2965ab7227b422 to your computer and use it in GitHub Desktop.
Decentralized hongeipii counter
#!/bin/bash
if [ ! -e hongeipii.txt ]
then
page=1
next=`curl -H "Accept: application/activity+json" https://mstdn.beer/users/hongeipii/followers|jq -r '.first'`
while [ $next != 'null' ]
do
json=`curl -X GET -H "Accept: application/activity+json" -d "page=${page}" https://mstdn.beer/users/hongeipii/followers`
echo ${json}|jq -r '.orderedItems[]' >> hongeipii.txt
next=`echo ${json}|jq -r '.next'`
page=`expr $page + 1`
echo "page = ${page}"
done
fi
echo "hongeipii = `grep hongeipi hongeipii.txt -c`"
echo ""
echo "num server"
echo "-----------------"
grep hongeipii hongeipii.txt|sort|sed -E "s#^https://([^/]*)/.*#\1#"|uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment