repo: actpub
action: blob
revision: 
path_from: ap-getfollowers
revision_from: refs/heads/master:
path_to: 
revision_to: 
git.thebackupbox.net
actpub
git clone git://git.thebackupbox.net/actpub

blob of:

actpub

/ ap-getfollowers

blob_plain of this file

refs/heads/master:/ap-getfollowers

 #!/usr/bin/env bash

 ### use $1 for the acct of whose followers we want to grab...

 if [ ! "$1" ];then
   printf "usage: ap-getfollowers \n" 2>&1
   exit 1
 fi

 acct="$1"
 url="$(ap-getactor "$acct" | jq -r '.followers')"

 ### need to grab first page, then while loop until no next...
 next="$url"
 while [ "$next" ];do
   echo "ap-getfollowers: getting $next" >&2
   resp="$(ap-signed-get "$next")"
   jq -r '.orderedItems//[]' <<< "$resp" | jq -r '.[]'
   next="$(jq -r '.next//.first//""' <<< "$resp")"
 done