-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgoogle_utils.sh
More file actions
30 lines (26 loc) · 932 Bytes
/
google_utils.sh
File metadata and controls
30 lines (26 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# youtube.subs.all.delete() {
# if [ -z "$GOOGLE_ACCESS_TOKEN" ]; then
# echo "Error: ACCESS_TOKEN environment variable is not set."
# return 1
# fi
# nextPageToken=""
# while : ; do
# response=$(curl -s -G \
# --data-urlencode "part=id" \
# --data-urlencode "mine=true" \
# --data-urlencode "maxResults=50" \
# --data-urlencode "pageToken=$nextPageToken" \
# "https://www.googleapis.com/youtube/v3/subscriptions" \
# -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN")
# subscription_ids=$(echo "$response" | jq -r '.items[].id')
# for id in $subscription_ids; do
# curl -s -X DELETE \
# "https://www.googleapis.com/youtube/v3/subscriptions?id=$id" \
# -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN"
# echo "Deleted subscription $id"
# done
# nextPageToken=$(echo "$response" | jq -r '.nextPageToken // empty')
# [ -z "$nextPageToken" ] && break
# done
# }