YouTube Shorts Autoscroll and Seek

Scrolls in YT Shorts automatically after a video finished

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         YouTube Shorts Autoscroll and Seek
// @version      1.2
// @description  Scrolls in YT Shorts automatically after a video finished
// @author       Taki7o7 aka. WaGi-Coding
// @match        *://www.youtube.com/shorts/*
// @require      http://code.jquery.com/jquery-latest.js
// @run-at       document-idle
// @license MIT
// @namespace https://greasyfork.org/users/772124
// ==/UserScript==

(function() {
    'use strict';

    var $ = window.jQuery;
    var vid = null;


    function GetVidAndBtn(){
        if (document.querySelector("#shorts-player > div.html5-video-container > video") != null) {

            vid = document.querySelector("#shorts-player > div.html5-video-container > video");

            $(vid).removeAttr('loop');

            $(vid).on('ended',function(){

                console.log("ended!");

                $('#navigation-button-down').find("button").first().click();

            });
        }
    }

    var timer = setInterval(() => {
        addEventListener("keydown", function(e) {
          switch (e.key.toUpperCase()) {

              case "ARROWLEFT":
              case "A":
                  vid.currentTime=vid.currentTime-2;
                  break;
              case "ARROWRIGHT":
              case "D":
                  vid.currentTime=vid.currentTime+2;
                  break;

              default:
                  console.log(e.key.toUpperCase());
                  break;
          }
      });
        GetVidAndBtn();
        //vid.currentTime = vid.currentTime - 1;
        clearInterval(timer);
    }, 500);

    var timer2 = setInterval(() => {
        GetVidAndBtn();
        if ($('ytd-reel-video-renderer').length >= 28) {
            $('ytd-reel-video-renderer:lt(9)').remove();
        }
    }, 500);

})();