2013-10-17 20 views

回答

1

您可能會從YouTube Analytics(分析)API到目前爲止得到它的基礎上,VideoID的,我該數據在谷歌Apps腳本在功能下面創建。

function videoShareCount(channelId,videoId) { 
    var today = new Date(); 
    var startDate = YouTube.Videos.list('snippet',{id:videoId}).items[0].snippet.publishedAt; 
    var todayFormatted = Utilities.formatDate(today, 'UTC', 'yyyy-MM-dd') 
    var startDateFormatted = Utilities.formatDate(new Date(startDate), 'UTC', 'yyyy-MM-dd'); 
    var analyticsResponse = YouTubeAnalytics.Reports.query(
    'channel==' + channelId, 
    startDateFormatted, 
    todayFormatted, 
    'shares', 
    { 
     dimensions: 'video', 
     filters: 'video=='+videoId, 
    }); 
    if (analyticsResponse.rows) 
    return analyticsResponse.rows[0][1]; 
    else 
    return 0; 
} 
+0

這似乎是使用某些分析的最佳方法。 Albert,@Surabhil Sergy,謝謝你的回答。 – Olexii

1

Data API v3中未提供此功能。但是這個請求似乎有效,所以我會提交一個功能請求。

請隨時聯繫file a feature request in public issue tracker以獲取有關此問題的更新。

+0

好的,@IbrahimUlukaya,謝謝。 但是,如果有任何其他方式獲得YouTube上指定視頻的份額數量? – Olexii

相關問題