Skip to content

Instantly share code, notes, and snippets.

@atomotic
Created August 31, 2018 08:26
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 atomotic/f540f6d0a5d3ddf4cb25da85a330589f to your computer and use it in GitHub Desktop.
Save atomotic/f540f6d0a5d3ddf4cb25da85a330589f to your computer and use it in GitHub Desktop.
get the list of followers of a mastodon user. output in ntriples
#!/usr/bin/env bash
instance="https://digipres.club"
user="raffaele"
json=$(curl -s -H "Accept: application/activity+json" $instance/users/$user/followers?page=1)
echo "$json" | jq -r .orderedItems[] | xargs -I% echo "<%> <follows> <$instance/user/$user> ."
next=$(echo "$json" | jq -r .next)
while true; do
json=$(curl -s -H "Accept: application/activity+json" "$next")
echo "$json" | jq -r .orderedItems[] | xargs -I% echo "<%> <follows> <$instance/user/$user> ."
next=$(echo "$json" | jq -r .next)
if [ -z "$next" ]; then
break
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment