Greasy Fork is available in English.

Youtube like/dislike video and skip ad keyboard shortcuts

Adds keyboard shortcuts [ and ] for liking and disliking videos, and s for skipping pre-video and banner ads.

< Feedback on Youtube like/dislike video and skip ad keyboard shortcuts

Review: OK - script works, but has bugs

§
Posted: 2022-05-15

To fix this for current (2022-05-14) youtube, do this:

Change:

videoinfo = document.getElementsByTagName("ytd-video-primary-info-renderer");
if(videoinfo.length == 1) {

To:

videoinfo = document.getElementsByTagName("ytd-menu-renderer");
if(videoinfo.length >= 1) {

§
Posted: 2022-05-16

Actually that's being a little flaky... this might work better:

videoinfo = document.getElementsByTagName("ytd-watch-metadata");
if(videoinfo.length >= 1) {
buttons = videoinfo[0].getElementsByTagName("ytd-toggle-button-renderer");
like = buttons[0];
dislike = buttons[1];
}

§
Posted: 2022-11-03

This doesn't work in the latest youtube after last week's update. Any thoughts?

§
Posted: 2022-11-03

Nevermind, switching to another available script recently updated.

§
Posted: 2022-11-04

Nevermind, switching to another available script recently updated.

What script did you switch to?

§
Posted: 2022-11-04

Here's a new version that works (with no skippind key shortcut anymore):

// ==UserScript==
// @name Youtube like/dislike video and skip ad keyboard shortcuts
// @namespace nerevar009
// @include https://www.youtube.com/*
// @description Adds keyboard shortcuts [ and ] for liking and disliking videos
// @version 1.2
// @grant none
// ==/UserScript==

var onvideopage, like, dislike, tag;
onvideopage = true;
if(!/^\/watch/.test(location.pathname)) onvideopage = false;

addEventListener("keypress", function(e) {
if(!onvideopage)
return;

if(e.target.getAttribute("contenteditable") == "true")
return;

tag = e.target.tagName.toLowerCase();
if(tag == "input" || tag == "textarea")
return;

like=document.getElementById("segmented-like-button").children[0].children[0].children[0];
dislike=document.getElementById("segmented-dislike-button").children[0].children[0].children[0];

if(e.code == "BracketLeft" && like)
like.click();
else if(e.code == "BracketRight" && dislike)
dislike.click();
});

Post reply

Sign in to post a reply.