Skip to content

Instantly share code, notes, and snippets.

@emnopal
Created June 3, 2024 05:41
Show Gist options
  • Select an option

  • Save emnopal/f1fb4ceb4d4dadf4ea879df6798611a2 to your computer and use it in GitHub Desktop.

Select an option

Save emnopal/f1fb4ceb4d4dadf4ea879df6798611a2 to your computer and use it in GitHub Desktop.
const foo = document.getElementsByTagName('ytmusic-responsive-list-item-renderer');
const musicObj = {}
for (let i = 0; i < foo.length; i++){
let newObj = foo[i];
let otherObj = newObj.getElementsByTagName('yt-formatted-string');
for (let j = 0; j < otherObj.length; j++){
let a = otherObj[j];
let aObj = a.getElementsByTagName('a');
let aObjGHTML = aObj[0];
if (aObjGHTML){
if (aObjGHTML.href.includes('watch')) {
// console.log(aObjGHTML)
musicObj[aObjGHTML.innerHTML] = aObjGHTML.href
}
}
}
}
console.log(musicObj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment