Created
August 31, 2018 08:26
-
-
Save atomotic/f540f6d0a5d3ddf4cb25da85a330589f to your computer and use it in GitHub Desktop.
get the list of followers of a mastodon user. output in ntriples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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