💎 DUOLINGO LESSON SOLVER & XP EARNER

One of the fastest Duolingo lesson solvers so you can complete practices and legendaries with no effort at all.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         💎 DUOLINGO LESSON SOLVER & XP EARNER
// @namespace    http://tampermonkey.net/
// @version      v1
// @description  One of the fastest Duolingo lesson solvers so you can complete practices and legendaries with no effort at all.
// @author       freepentests
// @match        *://*.duolingo.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=duolingo.com
// @grant        none
// @license      MIT
// @run-at       document-start
// ==/UserScript==

// I was reading apersongithub's scripts that let you get free super and duolingo max by modifying fetch and XHR responses in memory, so I decided I would make a script similar to his, but as a cheat to let you complete lessons
// The reason this works is because Duolingo's session API endpoint doesn't check whether the questions are valid.
// This is not compatible with stories at the moment, but this does work with practices, lessons, and legendaries, and it is one of the fastest lesson solvers.

const sessionsUrl = 'https://www.duolingo.com/2023-05-23/sessions';

window.originalFetch = window.fetch;

window.fetch = (url, json) => {
    if (url === sessionsUrl) {
        return window.originalFetch(url, json).then(async (response) => {
            let numOfQuestions = 1;

            const clonedResponse = response.clone();
            const clonedRespText = await clonedResponse.text();
            const clonedRespJson = JSON.parse(clonedRespText);

            if (clonedRespJson.type.startsWith('LEGENDARY')) {
                numOfQuestions = 2; // legendaries require at least 2 questions
            };

            const challengePayload = {"character":{"url":"https://d2pur3iezf4d1j.cloudfront.net/images/51d3bded9ecbd8bf6e9869041c437ba9","image":{"pdf":"https://d2pur3iezf4d1j.cloudfront.net/images/51d3bded9ecbd8bf6e9869041c437ba9","svg":"https://d2pur3iezf4d1j.cloudfront.net/images/0f284113af41f7f7296263183701a13b"},"gender":"MALE","correctAnimation":"https://simg-ssl.duolingo.com/lottie/Falstaff_CORRECT_Cropped_NotBad.json","incorrectAnimation":"https://simg-ssl.duolingo.com/lottie/Bear_INCORRECT_Cropped.json","idleAnimation":"https://simg-ssl.duolingo.com/lottie/Falstaff_IDLE_Cropped.json","name":"FALSTAFF","avatarIconImage":{"pdf":"https://simg-ssl.duolingo.com/world-characters/avatars/falstaff_avatar_icon.pdf","svg":"https://simg-ssl.duolingo.com/world-characters/avatars/falstaff_avatar_icon.svg"}},"prompt":"What is the best way to get XP on Duolingo?","correctIndex":0,"options":[{"text":"By using this script ✅💎💎💎"},{"text":"By doing lessons yourself 😴😴😴"}],"type":"assist","metadata":{"challenge_construction_insights":{"birdbrain_probability":0.98932004,"birdbrain_source":"birdbrain_v2","content_length":7,"best_solution":"THIS CHEAT","is_adaptive":false,"cefr_level":"CEFR_A1","cefr_subsection":"A1.0","tagged_kc_ids":["d34dd0c4df69ca91b277730638b12a4a"],"teaching_kc_ids":["d34dd0c4df69ca91b277730638b12a4a"],"content_versions":[]},"highlight":[],"learning_language":"es","other_options":["By doing lessons yourself 😴😴😴"],"solution_key":"d34dd0c4df69ca91b277730638b12a4a","translation":"By using this script ✅💎💎💎","ui_language":"en","word":"What is the best way to get XP on Duolingo?","language":"es","type":"assist","content_versions":[],"lexeme_ids_to_update":["d34dd0c4df69ca91b277730638b12a4a"],"specific_type":"assist","lexemes_to_update":["d34dd0c4df69ca91b277730638b12a4a"],"generic_lexeme_map":{},"num_comments":0,"from_language":"en","skill_tree_id":"209338530709d160ba0049addfd664ee"},"newWords":[],"progressUpdates":[],"challengeGeneratorIdentifier":{"specificType":"assist","generatorId":"d34dd0c4df69ca91b277730638b12a4a"}};
            clonedRespJson.challenges = Array(numOfQuestions).fill(challengePayload);

            const modified = JSON.stringify(clonedRespJson);

            return new Response(modified, { status: response.status, statusText: response.statusText, headers: response.headers });
        });
    };

    return window.originalFetch(url, json);
};