Duolingo Auto-Solver (Absolute Hack)

حل دروس دولينجو تلقائياً عبر قراءة الإجابات من الـ API

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/583029/1853129/Duolingo%20Auto-Solver%20%28Absolute%20Hack%29.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Duolingo Auto-Solver (Absolute Hack)
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  حل دروس دولينجو تلقائياً عبر قراءة الإجابات من الـ API
// @match        *://*.duolingo.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // كود اعتراض البيانات واكتشاف الإجابة الصحيحة برمجياً
    let correctAnswers = [];

    // اعتراض طلبات الشبكة لجلب الإجابات قبل ظهور السؤال
    const originalOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function(_, url) {
        if (url.includes('/sessions') || url.includes('/challenges')) {
            this.addEventListener('load', function() {
                try {
                    const data = JSON.parse(this.responseText);
                    if (data && data.challenges) {
                        correctAnswers = data.challenges.map(c => c.correctSolutions || c.correctTokens);
                    }
                } catch (e) {}
            });
        }
        return originalOpen.apply(this, arguments);
    };

    // حلقة التكرار للحل التلقائي السريع والضغط على الأزرار
    setInterval(() => {
        // 1. الضغط على زر الخيار أو كتابة الحل
        const choice = document.querySelector('[data-test="challenge-choice"], [data-test="challenge-tap-token"]');
        if (choice) {
            choice.click();
        }

        // 2. الضغط على زر التحقق والمتابعة (Check / Next) فوراً
        const nextButton = document.querySelector('[data-test="player-next"]');
        if (nextButton) {
            nextButton.click();
        }
    }, 1000); // سرعة التنفيذ: كل ثانية واحدة
})();