您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Script to automatically like Youtube Videos Opened in Browser
- // ==UserScript==
- // @name Youtube AutoLike
- // @homepageURL https://github.com/Koalapvh13/Tampermonkey-Scripts
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Script to automatically like Youtube Videos Opened in Browser
- // @license MIT
- // @icon https://lh3.googleusercontent.com/zw07Qyfb7MnF8J9pZJ6eYheztKq1shP1j6tUqyDYZj6R60nNrrPrFZvC9k5JIe2m9t2GfQLbXg=w128-h128-e365-rj-sc0x00ffffff
- // @author Matheus Dias Vieira
- // @copyright 2020, Matheus Dias Vieira (https://github.com/Koalapvh13)
- // @match http*://*.youtube.com/watch?v=*
- // @include http*://*.youtube.com/*
- // @include http*://youtube.com/*
- // @include http*://*.youtu.be/*
- // @include http*://youtu.be/*
- // @run-at document-end
- // @grant none
- // ==/UserScript==
- (function () {
- 'use strict';
- const like = () => {
- const interval = setInterval(() => {
- const btnlike = document.querySelector("#top-level-buttons > ytd-toggle-button-renderer:nth-child(1)")
- if (btnlike) {
- clearInterval(interval)
- if (!btnlike.classList.contains("style-default-active")) {
- btnlike.click()
- }
- }
- }, 1000)
- }
- document.body.addEventListener("yt-navigate-finish", function (event) {
- if (window.location.pathname == "/watch") {
- console.log(window.location.href)
- console.log(window.location.pathname)
- like()
- }
- });
- })();