Mas Koding
/

Catatan Youtube

Mas Koding
Januari 07, 2025

 1. Menampilkan profil author yg melakukan komentar di stream youtube live chat



(() => {
    const targetNode = document.querySelector("#items");
    const config = {
        childList: true,
        subtree: false
    };
    const callback = (mutationsList, observer) => {
        for (const mutation of mutationsList) {
            if (mutation.type === "childList") {
                if (mutation.addedNodes.length > 0) {
                    // console.log("---------------");
                    mutation.addedNodes.forEach(node => {
                        const elTarget = node?.querySelector("#content");
                        if (elTarget) {
                            console.log(`Name : ${elTarget?.querySelector("#author-name")?.innerText}`);
                            // console.log(`Name : ${elTarget?.querySelector("#author-name")?.innerText}
                            // ${elTarget?.querySelector("#message")?.innerText}`);
                        }
                    });
                }
            }
        }
    };
    const observer = new MutationObserver(callback);
    observer.observe(targetNode, config);
})();




2.  belum ada tambahan...
Share Article

Spread the word

0 Komentar

Mas Koding

Sharing knowledge about technology, programming tutorials, and the latest web development trends. Built for developers by developers.

Discover

© 2025 Mas Koding. Crafted with h.

System Operational