0

I use YouTube keyboard shortcuts f, j, k, l, m, and 1–0. Is there a similar key to toggle the like and dislike buttons (thumbs-up or thumbs-down buttons)?

1

If you install this user script, you will be able to like and dislike videos with keyboard shortcuts
[ and ] (and as bonus you can even skip the ad with s key)

// ==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, and s for skipping pre-video and banner ads.
// @version     1.1
// @grant       none
// ==/UserScript==
var onvideopage, skipad, skipbannerad, videoinfo, buttons, like, dislike, tag;
function findButtons() { if(!/^/watch/.test(location.pathname)) { onvideopage = false; return; } onvideopage = true;
skipad = document.getElementsByClassName("videoAdUiSkipButton"); if(skipad.length == 1) skipad = skipad[0]; else skipad = null;
skipbannerad = document.getElementsByClassName("close-padding"); if(skipbannerad.length == 1) skipbannerad = skipbannerad[0]; else skipbannerad = null;
videoinfo = document.getElementsByTagName("ytd-video-primary-info-renderer"); if(videoinfo.length == 1) { buttons = videoinfo[0].getElementsByTagName("button"); like = buttons[0]; dislike = buttons[1]; } else { like = null; dislike = null; } }
findButtons(); var observer = new MutationObserver(findButtons); observer.observe(document.documentElement, {childList: true, subtree: true});
// add keybindings 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;
if(e.code == "BracketLeft" && like) like.click(); else if(e.code == "BracketRight" && dislike) dislike.click(); else if(e.code == "KeyS") { if(skipad) skipad.click(); else if(skipbannerad) skipbannerad.click(); } });

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.