Created
January 3, 2018 16:31
-
-
Save akz92/3593a68839e156db1748309170cba89c to your computer and use it in GitHub Desktop.
Vzaar category cleaner
This file contains hidden or 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
#!/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