💎 DUOLINGO LESSON SOLVER & XP EARNER

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);
};