1 year ago
#377388
user18712810
How to update a Youtube channel's name and icon with YouTube API in Google Apps Script
Code:
const keywords=["keyword1","keyword2","keyword3"];
function updateChannel() {
var channels=YouTube.Search.list("snippet",{
q:keywords[Math.floor(Math.random() * keywords.length)],
type:"channel"
})
var channelpick=channels.items[Math.floor(Math.random() * channels.items.length)]
var channel=YouTube.Channels.list("snippet,brandingSettings",{'id': "<channel_id>"}).items[0];
channel.snippet.title=channelpick.snippet.title;
channel.snippet.thumbnails.default.url=channelpick.snippet.thumbnails.default.url;
YouTube.Channels.update(channel, "snippet")
}
So, what my code does is that it searches for channels under a random keyword and then sets my youtube channel's name and icon as the name and icon of the channel it picked
But an error is occuring when I run YouTube.Channels.update()
function
Error: GoogleJsonResponseException: API call to youtube.channels.update failed with error: 'snippet'
Does anyone know how to fix this error?
google-apps-script
youtube-data-api
0 Answers
Your Answer