Skip to content

Instantly share code, notes, and snippets.

View orafaribeiro's full-sized avatar

Rafael Ribeiro orafaribeiro

View GitHub Profile
@orafaribeiro
orafaribeiro / playlist_time.js
Last active December 12, 2020 21:26 — forked from cesarhilario/playlist_time.js
Calcula o tempo total de uma playlist no Youtube. É só colar no console na página da playlist. Update para a nova interface do Youtube
(function() {
const playlist = document.querySelector("ytd-playlist-video-list-renderer");
const timesContainer = playlist.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer");
let timeSeconds = 0;
for(let i = 0; i < timesContainer.length; i++){
const timeStr = timesContainer[i].querySelector('span.style-scope').innerHTML;
const timeParts = timeStr.split(":");
const seconds = (timeParts[0] * 60) + parseInt(timeParts[1]);