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 3
// @license MIT
// @namespace https://gf.qytechs.cn/users/803889
// ==/UserScript==
let i = 0
let startTimeInMs = Date.now()
let timeexpired = true
let SUBSCRIBE_BUTTON = '#subscribe-button-shape .yt-core-attributed-string.yt-core-attributed-string--white-space-no-wrap'
let LIKE_BUTTON = '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'
window.onload = function() {
Delay(startTimeInMs, SUBSCRIBE_BUTTON,LIKE_BUTTON,1000,9000)
}
function Like(){
try{
if (timeexpired == true || i > 0){throw 'Something went wrong. :(' + '\n' + 'Send me a message on GreasyFork.' + '\n' + 'https://gf.qytechs.cn/users/803889'}
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 == false){throw 'Subscribed first! >:('}
if (LIKE_BUTTON.ariaPressed=='true'){throw 'Already Liked! :)'}
if (SUBSCRIBE_BUTTON == true && LIKE_BUTTON.ariaPressed=='false'){
LIKE_BUTTON.click();
throw 'Subscribed and Liked!'
}
}
catch(err){console.log(err)}
}
function Delay(startTimeInMs, selector, selector2, checkFrequencyInMs, timeoutInMs) {
loopSearch()
function loopSearch() {
if (document.querySelector(selector) != null && document.querySelector(selector2) != null) {
timeexpired = false
i = 0
Like()
return
}
setTimeout(() => {
if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs){
return
}
loopSearch()
}, checkFrequencyInMs)
i++
console.log(i)
if (i >= timeoutInMs / 1000){
Like()
}
}
}
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址