Last active
February 21, 2024 20:44
-
-
Save SidharthArya/232b9aaeb16e72c7308f631778866534 to your computer and use it in GitHub Desktop.
movie-web-autonext Tampermonkey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name movie-web-autonext | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-02-21 | |
// @description try to take over the world! | |
// @author You | |
// @match https://movie-web.app/media/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=movie-web.app | |
// @grant none | |
// ==/UserScript== | |
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
let fired = false; | |
let currentUrl = ''; | |
async function movieWebAutoNext() { | |
if (fired) return; | |
fired = true; | |
let interval = 10*1000; | |
while (true) { | |
let progress = document.getElementsByClassName('absolute top-0 dir-neutral:left-0 h-full rounded-full bg-progress-filled flex justify-end items-center') | |
if (!progress) {await sleep(interval); continue} | |
if (!progress[0]) {await sleep(interval); continue} | |
console.log(progress); | |
progress = parseFloat(progress[0].style.width.slice(0,-1)); | |
if (progress < 90) {await sleep(interval); continue} | |
console.log(progress); | |
if (progress > 90) { | |
let next = document.getElementsByClassName('font-bold rounded h-10 w-40 scale-95 hover:scale-100 transition-all duration-200 bg-buttons-primary hover:bg-buttons-primaryHover text-buttons-primaryText flex justify-center items-center'); | |
if (!next) {await sleep(interval); continue} | |
let but = next[0]; | |
but.click(); | |
fired = false; | |
return | |
} | |
} | |
} | |
(async function monkeyScript() { | |
'use strict'; | |
let newUrl = window.location.href; | |
while (true) { | |
console.log(newUrl); | |
if (newUrl !== currentUrl) await movieWebAutoNext(); | |
await sleep(10*1000); | |
} | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment