loverseny / spooky-ws-temp

// ==UserScript==
// @name         spooky-ws-temp
// @namespace    ncore
// @version      1.0.0
// @description  spooky ws
// @author loverseny
// @match        https://ncore.cc/torrents*
// @grant        none
// @license 	 MIT
// ==/UserScript==

(function() {
    'use strict';

    // <div id="spo0kyD" data-uuid="YxbSJXRxHIjxDVKqViCWqOohhYHv" data-recaptcha="false" style="z-index:1000;position:fixed;left:790px;width:100px;top:420px;"><img style="cursor:pointer;" src="https://nc-img.cdn.l7cache.com/spooky2k20/sp2020-36.png"></div>

    var f = new WebSocket("wss://spooky.ncore.cc:3001/spooky");
    f.onopen = function() {
        console.log("WS connected")
    }
    f.onmessage = function(m) {
        // console.log("SPOOKY Message arrived", m)
        var x = JSON.parse(m.data);
        console.log("WS Data arrived:", x);
        if (x.eventid) {
            // data: "{\"type\":\"spooky\",\"eventid\":\"DROgDsMQnyuXBCBGoYSBYFpCdunO\",\"recaptcha\":false}\n"
            var a = {
                eventid: x.eventid,
                userid: $("#confg").attr("data-uid")
            };

            console.log("Click spooky websocket...", a);
            f.send(JSON.stringify(a));
        }
        // setTimeout(nextPage, 7000);
    }

    function nextPage() {
        console.log("Next page")
        let page = Math.floor(Math.random() * 100) + 1;
        window.location.href = "https://ncore.cc/torrents.php?oldal="+page+"&miszerint=seeders&hogyan=DESC";
    }

    // check();
    var time = 1000 * 60 * 10;
    setTimeout(nextPage, time);

})();