PixelPlanet (and clones) Captcha Solver

Solve PixelPlanet and clones captchas automatically (Supported: pixmap, pixelya, pixworld, pixuniverse, pixelworldgame, pxgame, pixelplanet, pixelverse)

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name         PixelPlanet (and clones) Captcha Solver
// @namespace    vermei_and_nof
// @version      1.11
// @description  Solve PixelPlanet and clones captchas automatically (Supported: pixmap, pixelya, pixworld, pixuniverse, pixelworldgame, pxgame, pixelplanet, pixelverse)
// @match        *://*.pixuniverse.fun/*
// @match        *://*.pixmap.fun/*
// @match        *://*.pixelya.fun/*
// @match        *://*.pixworld.net/*
// @match        *://*.pixelworldgame.xyz/*
// @match        *://*.pxgame.xyz/*
// @match        *://*.fuckyouarkeros.fun/*
// @match        *://*.pixelplanet.fun/*
// @match        *://*.pixverse.fun/*
// @match        *://*.pixelroyal.fun/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    const site = window.location.host;
    var aiLink = 'https://fuururuny-pixmap-captcha.hf.space/gradio_api/call/predict';
    if (site.includes('pixuniverse.fun') || site.includes('pixelworldgame.xyz')) {
        aiLink = 'https://fuururuny-pixuniverse-captcha.hf.space/gradio_api/call/predict';
    }
    if (site.includes('pixelplanet.fun') || site.includes('fuckyouarkeros.fun')) {
        aiLink = 'https://fuururuny-pixelplanet-captcha.hf.space/gradio_api/call/predict';
    }
    const ispixworld = site.includes('pixworld.net');
    function sleep(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
}

    function do_url_to_svg(url) {
        return fetch(url)
            .then(function(response) {
                if (response.status !== 200) {
                    console.log('Looks like there was a problem. Status Code: ' + response.status);
                    return;
                }
                return response.text();
            })
            .catch(function(err) {
                console.log('Fetch Error :-S', err);
            });
    }

    function solveCaptcha() {
        const captchaElement = document.querySelector(`img[alt="CAPTCHA"]`);
        const url = captchaElement.src;

        const svgelement = do_url_to_svg(url);

        svgelement.then(function(svgData) {
            const postData = {
                data:[svgData.replace(/stroke="#{0,1}\S+"/, 'stroke="black"').replace(/stroke-width: \d+;/, 'stroke-width: 4;').replace(/fill="#{0,1}\S+"/, 'fill="#FFFFFF"').replace(/fill="rgba\(240, 240, 240, 0.9\)"/, 'fill="#FFFFFF"').replace(/fill="rgba\(0, 0, 0, 0.7\)"/, 'fill="rgba(0, 0, 0, 0)"')]
            };

            fetch(aiLink, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(postData)
            })
            .then(function(response) {
                if (response.status !== 200) {
                    console.log('Looks like there was a problem. Status Code: ' + response.status);
                    return;
                }
                response.json().then(function(data) {
                    const eventID = data.event_id;
                    fetch(`${aiLink}/${eventID}`, {
                        method: 'GET'
                    })
                    .then(function(response) {
                        if (response.status !== 200) {
                            console.log('Looks like there was a problem. Status Code: ' + response.status);
                            return;
                        }
                        response.text().then(function(data) {
                            const answer = data.match(/"([^"]+)"/)[1];
                            const captchafield = document.querySelector(`input[name='captcha']`);
                            captchafield.value = answer;
                            console.log(answer);
                            if (document.querySelector(`.Alert`) || document.querySelector(`.CaptchaAlert`)) {
                                const sendcaptcha = document.querySelector(`button[type="submit"]`);
                                sendcaptcha.click();
                            }
                        });
                    })
                    .catch(function(err) {
                        console.log('Fetch Error :-S', err);
                    });
                });
            })
            .catch(function(err) {
                console.log('Fetch Error :-S', err);
            });
        });
    }

    function getNewPWCaptcha() {
        return fetch('https://api.henrixounez.com/pixworld/captcha.png')
        .then(response => response.blob())
        .then(blob => {
            return new Promise((resolve, reject) => {
                const reader = new FileReader();
                reader.onload = () => resolve(reader.result.split(',')[1]);
                reader.onerror = error => reject(error);
                return reader.readAsDataURL(blob);
            });
        })
    }

    async function PWSolveCaptcha() {
        await sleep(100);
        const base64Element = getNewPWCaptcha();

        base64Element.then(function(base64str) {
            let nocaptcha = 'iVBORw0KGgoAAAANSUhEUgAAAfQAAAEsCAYAAAA1u0HIAAANHUlEQVR42u3dW27rNhQF0CTIBDT/QWoI6Vda14gtUuIhD6m1gAsUqK1IfG1S1uNz3/efDwBgal+KAAAEOgAg0AEAgQ4ACHQAEOgAgEAHAAQ6ACDQAUCgAwACHQAQ6ACAQAcAgQ4ACHQAQKADAAIdAAQ6ACDQAQCBDgAIdAAQ6ACAQAcABDoAINABQKADAAIdABDoAIBABwCBDgAIdABAoAMAAh0ABDoAINABAIEOAAh0ABDoAIBABwAEOgAg0AFAoAMAAh0AEOgAgEAHAAQ6AAh0AECgAwACHQAQ6AAg0AEAgQ4ACHQAQKADgEAHAAQ6ACDQAQCBDgACHQAQ6ACAQAcABDoACHQAQKADAAIdABDoACDQAQCBDgAIdABAoAN8fHx8fGzb9rFtm4JAoAPMHOaCnTv47tWRnu373mQ7tduacRBa/ViVPyPGIPqM39xghd6qo2lYgKCH4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KqAulWq8Crp7ay1gGXK9HZ3C0hxH92lvYrNCHN/zSVVtJw3x1RXXUSqzFwN26DM6skqMD6MrjdaMmalFvd2u53R77vdoYkqVuR/Zr7cUKPXQw7/3azNGdo/ZRlFmv2F994J+hHNVdnzI6e63HqH6tnVihDw31lt9v8WzlnivEiDLgehlFf362/bhz3erXAp0ODffV9yI7wpVtv/tu6zJo+f0Mp91b1Gn0ABl1MaSBfY66bfk79cyvGc7OKfeOHbLVO7WPTnm1COazp9l7lUHN8dzltFxku3hXhy226/as8XUb/dyKFZ/3kc3nvu8/Ihfi1Lw/evXjFc4Qxyl3GLzyAmjBKXcIWKFeeYTuqqttkxcQ6LBUEK4ScI9v2nP7EIznlDtwadJxh8kLCHSwMp8+4NxzDAIdWCTgMtxzDLzntjXosFpfKdicYgeBDgAEccodAAQ6ACDQAQCBDgAIdAAQ6ACAQAcABDoAINABQKADAAIdABDoAIBABwCBDgAIdABAoAMAAh0ABDoAINABAIEOAAh0ABDoAIBABwAEOgAg0AFAoAMAAh0AEOgAgEAHAIEOAAh0AECgAwACHQAEOgAg0AEAgQ4ACHQAEOgAgEAHAAQ6ACDQAUCgAwACHQAQ6ACAQAcABDoACHQAQKADAAIdABDoACDQAQCBDgAIdABAoAOAQAcABDoAINABAIEOAAIdABDoAIBABwAEOgAIdABAoAMAAh0AEOgAcAf/AOc/Q37DHNALAAAAAElFTkSuQmCC'
            if (base64str == nocaptcha) {
                console.log("timeout")
                return;;
            }
            const postData = {
                data:[base64str]
            };

            fetch('https://fuururuny-pixworld-captcha.hf.space/gradio_api/call/predict', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(postData)
            })
            .then(function(response) {
                if (response.status !== 200) {
                    console.log('Looks like there was a problem. Status Code: ' + response.status);
                    return;
                }
                response.json().then(function(data) {
                    const eventID = data.event_id;
                    fetch(`https://fuururuny-pixworld-captcha.hf.space/gradio_api/call/predict/${eventID}`, {
                        method: 'GET'
                    })
                    .then(function(response) {
                        if (response.status !== 200) {
                            console.log('Looks like there was a problem. Status Code: ' + response.status);
                            return;
                        }
                        response.text().then(async function(data) {
                            const answer = data.match(/"([^"]+)"/)[1];
                            console.log(answer);
                            fetch(`https://api.henrixounez.com/pixworld/captcha/verify`, {
                                method: 'POST',
                                headers: {
                                    'Content-Type': 'application/json'
                                },
                                body: JSON.stringify({text: answer})
                            })
                            document.querySelector(`#__next > div:nth-child(1) > div > div > div:nth-child(1) > div:nth-child(2)`).click();
                        });
                    })
                    .catch(function(err) {
                        console.log('Fetch Error :-S', err);
                    });
                });
            })
            .catch(function(err) {
                console.log('Fetch Error :-S', err);
            });
        })
    }

    const observer = new MutationObserver(function(mutationsList, observer) {
        for (let mutation of mutationsList) {
            if (mutation.target.getAttribute('alt') === 'CAPTCHA' && mutation.type === 'attributes' && mutation.attributeName === 'src') {
                ispixworld ? PWSolveCaptcha() : solveCaptcha();
                observer.disconnect();
                observer.observe(document.documentElement, { childList: true, subtree: true, attributes: true });
                break;
            }
        }
    });

    observer.observe(document.documentElement, { childList: true, subtree: true, attributes: true });

})();