-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcurl_scripts.sh
More file actions
executable file
·105 lines (79 loc) · 5.1 KB
/
Copy pathcurl_scripts.sh
File metadata and controls
executable file
·105 lines (79 loc) · 5.1 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
ACCESS_TOKEN=ya29.Glu2BDCf9KyezzFA-VRevk5zlMK7CcxAK6YfrgltdJ2Ccqmu83_whK7i54OZhHU8lWvnS9qiEpS1KeF0utARxCBemIl8oKk6sCFVEDIoHRByazgiPhA_1VNWg8Zj
YOUR_API_KEY=AIzaSyAMkHWnLNAvpKte-XA9nh3RheX7lFn_dNM
## Get My Videos list.
## Result: ./video_list.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "type=video&forMine=true&maxResults=25&part=snippet" \
https://www.googleapis.com/youtube/v3/search/
## Get video info by ID.
## Only works on googel playground and don't need access_token.
## See: https://developers.google.com/youtube/v3/docs/videos/list
## Result: ./videos.txt
curl -vvv -i -G -d "id=QnrWLbJm9_8&part=snippet%2CcontentDetails%2Cstatistics&key=${YOUR_API_KEY}" \
https://www.googleapis.com/youtube/v3/videos
## Get My Channels.
## Can get the # of subscribers.
## Result: ./channel.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "mine=true&part=snippet%2CcontentDetails%2Cstatistics%2Clocalizations%2Cstatus%2CbrandingSettings%2CauditDetails" \
https://www.googleapis.com/youtube/v3/channels/
## Query reports for views by day, my owned channel.
## Result: ./query_report_view_by_day.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "ids=channel==MINE&start-date=2017-07-01&end-date=2017-08-01&metrics=views&dimensions=day" \
https://www.googleapis.com/youtube/analytics/v1/reports
## Query reports for views by day, my owned channel.
## Result: ./query_report_view_duration_by_day_product.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "ids=channel==MINE&start-date=2017-07-01&end-date=2017-08-01&metrics=views,averageViewDuration&dimensions=day,youtubeProduct" \
https://www.googleapis.com/youtube/analytics/v1/reports
## Result: ./query_report_views_watched_subscribers_gain_lost.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "ids=channel==MINE&start-date=2015-01-01&end-date=2017-09-01&metrics=views,estimatedMinutesWatched,averageViewDuration,averageViewPercentage,subscribersGained,subscribersLost&dimensions=day" \
https://www.googleapis.com/youtube/analytics/v1/reports
## Query reports for viewer percentage by ageGroup & gender.
## Result: ./query_report_viewerPercentage_by_ageGroup_gender.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "ids=channel==MINE&start-date=2017-07-01&end-date=2017-08-01&metrics=viewerPercentage&dimensions=ageGroup,gender" \
https://www.googleapis.com/youtube/analytics/v1/reports
## Query channel sections:
## Result: ./channel_sections.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "mine=true&part=snippet%2CcontentDetails" \
https://www.googleapis.com/youtube/v3/channelSections/
## or
curl -vvv -i -G -d "channelId=UCDd0gHs1F9U1Suw6aHGFH5g&part=snippet%2CcontentDetails&key=${YOUR_API_KEY}" \
https://www.googleapis.com/youtube/v3/channelSections
## Get PlaylistItems by playlist_id
## Result: ./playlist_items.txt
curl -vvv -i -G -d "playlistId=UUDd0gHs1F9U1Suw6aHGFH5g&maxResults=25&part=snippet%2CcontentDetails&key=${YOUR_API_KEY}" \
https://www.googleapis.com/youtube/v3/playlistItems
## Get comment threads by video.id
## Result: ./comment_threads.txt
curl -vvv -i -G -d "videoId=lTCZMFWqWPQ&part=snippet%2Creplies&key=${YOUR_API_KEY}" \
https://www.googleapis.com/youtube/v3/commentThreads
## Get comment threads by channel.id
## Result: ./comment_threads.txt
curl -vvv -i -G -d "channelId=UCDd0gHs1F9U1Suw6aHGFH5g&part=snippet%2Creplies&key=${YOUR_API_KEY}" \
https://www.googleapis.com/youtube/v3/commentThreads/
## Get video catagories by regionCode=US
## Result: ./video_categories.txt
curl -vvv -i -G -d "regionCode=US&part=snippet&key=${YOUR_API_KEY}" \
https://www.googleapis.com/youtube/v3/videoCategories
## Get all my subscribers by channel
## Result: ./my_subscribers.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "mySubscribers=true&part=subscriberSnippet" \
https://www.googleapis.com/youtube/v3/subscriptions
## Get maximum 1000 my recent subscribers by channel, same as above, except newest first.
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "myRecentSubscribers=true&part=subscriberSnippet" \
https://www.googleapis.com/youtube/v3/subscriptions
## Query reports for audience retention.
## Result: ./query_report_audience_watch_ratio.txt
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "ids=channel==MINE&filters=video==TA0su5jk-wk&start-date=2015-01-01&end-date=2017-08-30&metrics=audienceWatchRatio&dimensions=elapsedVideoTimeRatio" \
https://www.googleapis.com/youtube/analytics/v1/reports
curl -vvv -i -G -H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "ids=channel==MINE&filters=video==TA0su5jk-wk&start-date=2015-01-01&end-date=2017-08-30&metrics=relativeRetentionPerformance&dimensions=elapsedVideoTimeRatio" \
https://www.googleapis.com/youtube/analytics/v1/reports