Youtube Get Dislike

Get Dislike Amount.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Youtube Get Dislike
// @version      0.3
// @description  Get Dislike Amount.
// @license      MIT
// @homepageURL  https://github.com/willy67k/tampermonkey-userscripts
// @homepage     https://github.com/willy67k/tampermonkey-userscripts
// @source       https://github.com/willy67k/tampermonkey-userscripts/raw/master/src/youtube-get-dislike.js
// @namespace    https://github.com/willy67k/tampermonkey-userscripts/raw/master/src/youtube-get-dislike.js
// @author       Lilp
// @match        https://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant        none
// ==/UserScript==

(function () {
    "use strict";
    let url = "";

    setInterval(() => {
        if (url === window.window.location.href) {
            return;
        }
        url = window.window.location.href;

        const urlParams = new URLSearchParams(window.location.search).get("v");

        if (!urlParams) return;

        const inter = setInterval(() => {
            const disBtn = document.querySelector("dislike-button-view-model button");
            if (disBtn) {
                clearInterval(inter);
                fetch(`https://returnyoutubedislikeapi.com/Votes?videoId=${urlParams}`)
                    .then((res) => res.json())
                    .then((data) => {
                        if (disBtn && !disBtn.querySelector(".dislike")) {
                            disBtn.setAttribute("style", "width:auto !important");
                            disBtn.insertAdjacentHTML("beforeend", `<span class="dislike">${data.dislikes}</span>`);
                        }
                    });
            }
        }, 1000);
    }, 1000);

    // Your code here...
})();