Skip to content

Instantly share code, notes, and snippets.

@oppai
Created May 2, 2017 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oppai/15dbb74994c777458408fdc3032fc48f to your computer and use it in GitHub Desktop.
Save oppai/15dbb74994c777458408fdc3032fc48f to your computer and use it in GitHub Desktop.
#!/bin/sh
TOKEN="xxxxxx"
LIMIT_DATE=$(date -d 'week ago' +%s)
function unfollow()
{
account_id="$1"
last_twoot=$(curl -s -H "authorization:Bearer $TOKEN" -X GET https://pawoo.net/api/v1/accounts/$account_id/statuses | jq -r '.[0]')
last_twoot_at=$(echo "$last_twoot" | jq -r '.created_at')
last_twoot_date=$(date -d "$last_twoot_at" +%s)
if [ $last_twoot_date -lt $LIMIT_DATE ]; then
curl -s -H "authorization:Bearer $TOKEN" -X POST https://pawoo.net/api/v1/accounts/$account_id/unfollow > /dev/null
url=$(echo "$last_twoot" | jq -r '.account.url')
echo "ID:$account_id unfollow $url"
fi
}
unfollow $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment