Reputation: 193
Suppose a YouTube PlayList P has videos v1,v2,... . I want to find the total time any video from that list has been viewed prior to now (or prior to time T). Is there a JavaScript that I can run in the console to do this?
I see YT analytics provides the average view length for each individual video. But I do not see that information for a playlist.
Here is my partial attempt:
var totalTime = 0;
var videos = document.querySelectorAll('ytd-playlist-video-renderer');
videos.forEach(function(video) {
totalTime += parseInt(video.querySelector('.ytd-thumbnail-overlay-time-
status-renderer').innerText.split(':').pop());
});
console.log('Total time: ' + totalTime + ' seconds');
A related question on the number of views.
Upvotes: 1
Views: 284