Skip to content

Instantly share code, notes, and snippets.

@SubhrajitPrusty
Created August 5, 2022 17:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SubhrajitPrusty/544b4e1dd90d134b87b4818a63b3a197 to your computer and use it in GitHub Desktop.
Save SubhrajitPrusty/544b4e1dd90d134b87b4818a63b3a197 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Youtube Shorts autoscroll
// @version v0.0.1
// @grant none
// @author Subhrajit Prusty
// @description Just auto scroll through youtube shorts
// @include https://www.youtube.com/shorts/*
// ==/UserScript==
(function () {
setInterval(function () {
player = document.querySelector(".html5-video-player");
if (!player) {
console.log("======== No Active player, skipping ======= ")
return
}
video = player.querySelector("video") // to get video
down = document.querySelector("#navigation-button-down")
video.loop = false
if (video.currentTime === video.duration) {
actualButton = down.getElementsByClassName("style-scope ytd-shorts")
if (actualButton.length > 0) {
console.log("======== Playing next video ======= ")
actualButton[0].click()
}
}
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment