gpt4 book ai didi

google-apps-script - YouTubeAnalytics.Reports.query:对关联 channel 的身份验证

转载 作者:行者123 更新时间:2023-12-03 05:56:07 24 4
gpt4 key购买 nike

我设法安排了Google应用脚本文档中的示例代码;从关联的YouTube channel 检索数据。

function myFunction() {
var channelId ={MY ASSOCIATED CHANNEL ID};
// Set the dates for our report
var today = new Date();
var oneMonthAgo = new Date();
oneMonthAgo.setMonth(today.getMonth() - 1);
var todayFormatted = Utilities.formatDate(today, 'UTC', 'yyyy-MM-dd')
var oneMonthAgoFormatted = Utilities.formatDate(oneMonthAgo, 'UTC', 'yyyy-MM-dd');
//query
var analyticsResponse = YouTubeAnalytics.Reports.query(
'channel==' + channelId,
oneMonthAgoFormatted,
todayFormatted,
'views,likes,dislikes,shares',
{
dimensions: 'day',
sort: '-day'
});
//output
Logger.log(analyticsResponse)
}

不确定如何向我的关联 channel 验证脚本。

您能帮忙更正代码吗?

谢谢,

阿内什

最佳答案

  • 转到菜单资源->高级Google服务
  • 开启Youtube Analytics
  • 转到Google Developers控制台(在窗口底部有链接)或单击此处:https://console.developers.google.com/apis/library
  • 点击YouTube Analytics API
  • 单击启用

  • PS:请确保您使用的是与该 channel 关联的gmail帐户所拥有的脚本。

    关于google-apps-script - YouTubeAnalytics.Reports.query:对关联 channel 的身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39616959/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com