0

私はGoogleアプリケーションのスクリプトドキュメントで利用可能なサンプルコードを手配できました。関連するYouTubeチャンネルからデータを取得します。YouTubeAnalytics.Reports.query:関連付けられたチャンネルへの認証

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) 
} 

私の関連チャネルにスクリプトを認証する方法についてはわかりません。

コードを修正する手助けをしてください。メニューリソースへ

おかげで、

Aneesh

答えて

1
  1. ゴー - >高度なGoogleのサービス
  2. GoogleのデベロッパーコンソールにYouTubeアナリティクス
  3. ゴー上のスイッチ(ウィンドウの下部にありますリンクをクリックするか、ここをクリック)https://console.developers.google.com/apis/library
  4. YouTubeアナリティクスAPIをクリック
  5. クリックして有効にする

PS:チャネルに関連付けられたgmailアカウントが所有するスクリプトを使用していることを確認してください。

関連する問題