Skip to content

Instantly share code, notes, and snippets.

@akz92
Created January 3, 2018 16:31
Show Gist options
  • Save akz92/3593a68839e156db1748309170cba89c to your computer and use it in GitHub Desktop.
Save akz92/3593a68839e156db1748309170cba89c to your computer and use it in GitHub Desktop.
Vzaar category cleaner
#!/bin/sh
# This script depends on jd, to install it using Homebrew: brew install jd
next="https://api.vzaar.com/api/v2/videos?category_id=9488&per_page=100"
while [ ! "$next" == "null" ]
do
echo "*** Starting page: $next ***"
data=$(curl -s --request GET \
--url "$next" \
--header 'x-auth-token: foo' \
--header 'x-client-id: bar')
ids=$(echo "$data" | jq -r '.data[].id')
next=$(echo "$data" | jq -r '.meta.links.next')
while read id
do
curl -s --request DELETE \
--url "https://api.vzaar.com/api/v2/videos/$id" \
--header 'x-auth-token: foo' \
--header 'x-client-id: bar' > /dev/null
echo "Deleted! ID: $id"
done <<< "$ids"
done
echo "*** FINISHED! ***"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment