Skip to content

Instantly share code, notes, and snippets.

@atomotic
Created August 31, 2018 08:26
Embed
What would you like to do?
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