YouTube Auto-Liker

Hit Like button if Subbed

// ==UserScript==
// @name YouTube Auto-Liker
// @description Hit Like button if Subbed
// @match https://www.youtube.com/watch*
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/Logo_of_YouTube_%282015-2017%29.svg/2560px-Logo_of_YouTube_%282015-2017%29.svg.png
// @version 4.1
// @license MIT
    
// @namespace https://greasyfork.org/users/803889
// ==/UserScript==

let interval_documentHidden = setInterval(function checker() {
    if (!document.hidden) {
        if(document.readyState === 'complete') {
            try{
                SUBSCRIBE_BUTTON = document.querySelector('#subscribe-button-shape .yt-core-attributed-string.yt-core-attributed-string--white-space-no-wrap').innerHTML== 'Subscribed'
                
                LIKE_BUTTON = document.querySelector('button.yt-spec-button-shape-next.yt-spec-button-shape-next--tonal.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-m.yt-spec-button-shape-next--icon-leading.yt-spec-button-shape-next--segmented-start')

                if (SUBSCRIBE_BUTTON == true && LIKE_BUTTON.ariaPressed=='false'){
                    LIKE_BUTTON.click();                  
                }
            }catch{}
            console.log('"YouTube Auto-Liker" - script complete')
            clearInterval(interval_documentHidden)
        }
    }
}, 1000);