Skip to content

Instantly share code, notes, and snippets.

View zidan-p's full-sized avatar
🔒
in

Zidan Putra Rahman zidan-p

🔒
in
View GitHub Profile
@zidan-p
zidan-p / get-total-playlist-duration.js
Last active June 11, 2024 08:59
get sum of video length from playlist on youtube
function getTotalPlaylistDuration(){
const elements = document.querySelectorAll("#contents > ytd-playlist-video-renderer .badge-shape-wiz__text")
/**
* @type {{second: number, minute: number, hour: number}[]}
*/
const container = [];
elements.forEach(item =>{
const str = item.innerHTML.split(".")
const secondPos = str.length - 1;