Greasy Fork is available in English.

auto PayUp.video

payup.video auto watch video.

// ==UserScript==
// @name         auto PayUp.video
// @version      1.0
// @description  payup.video auto watch video.
// @author       Your Name
// @match        *://premiumbspot.blogspot.com/*
// @match        *://*.youtube.com/*
// @match        *://payup.video/tasks/*
// @grant        none
// @namespace https://greasyfork.org/users/1359431
// ==/UserScript==

(function() {
    'use strict';

    // Function to click on YouTube video player
    function clickYouTubeVideo() {
        var classes = document.getElementsByClassName('html5-video-player');
        if (classes.length > 0) {
            classes[0].click();
        }
    }

    // Function to check for specific text and close the page
    function checkAndClosePage() {
        const bodyText = document.body.innerText;
        const hasVerifyText = bodyText.includes('Verify you are human:');
        const hasNextVideoText = bodyText.includes('Next video');

        // Close the page if "Next video" is found and "Verify you are human" is not
        if (hasNextVideoText && !hasVerifyText) {
            window.close();
        }
    }

    // Function to click the PayUp button
    function clickPayUpButton() {
        const button = document.querySelector('.card_run.btn.btn-success');

        if (button) {
            button.click();
        }
    }

    // Click the YouTube video on page load
    clickYouTubeVideo();

    // Click the PayUp button on specific URL
    if (window.location.href.includes('https://payup.video/tasks/video/')) {
        clickPayUpButton();
    }

    // Check for text and close page periodically
    setInterval(checkAndClosePage, 1000); // Check every second

    // Click the PayUp button when returning to the same tab
    document.addEventListener('visibilitychange', () => {
        if (document.visibilityState === 'visible') {
            clickPayUpButton();
        }
    });
})();