Duolingo Simple XP Cheat

Get Duolingo XP easily

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Duolingo Simple XP Cheat
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Get Duolingo XP easily
// @author       You
// @match        *://*.duolingo.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Duolingo PRO API URL
    const apiURL = "https://api.duolingopro.net";
    
    // Add XP button
    function addXpButton() {
        if (document.querySelector('#dlp-xp-button')) return;
        
        const button = document.createElement('button');
        button.id = 'dlp-xp-button';
        button.textContent = 'GET XP';
        button.style.cssText = `
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 9999;
            background: #1cb0f6;
            color: white;
            border: none;
            border-radius: 16px;
            padding: 12px 24px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        `;
        
        button.addEventListener('click', getXP);
        document.body.appendChild(button);
    }
    
    // Function to get XP
    async function getXP() {
        try {
            const button = document.querySelector('#dlp-xp-button');
            const originalText = button.textContent;
            button.textContent = 'GETTING...';
            button.disabled = true;
            
            // Get JWT token from cookies
            const cookies = document.cookie.split(';');
            let jwtToken = '';
            for (let cookie of cookies) {
                if (cookie.trim().startsWith('jwt_token=')) {
                    jwtToken = cookie.split('=')[1];
                    break;
                }
            }
            
            if (!jwtToken) {
                alert('Please login to Duolingo first');
                button.textContent = originalText;
                button.disabled = false;
                return;
            }
            
            // Request XP (amount - 100)
            const response = await fetch(apiURL + '/request', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'Authorization': 'Bearer ' + jwtToken
                },
                body: JSON.stringify({
                    type: 'xp',
                    amount: 100,
                    version: '3.1BETA.04.2',
                    lang: 'en'
                })
            });
            
            const data = await response.json();
            
            if (data.status === 'completed') {
                button.textContent = '✓ XP ADDED';
                setTimeout(() => {
                    button.textContent = originalText;
                    button.disabled = false;
                }, 3000);
                
                // Show notification
                alert('100 XP added successfully!');
                
            } else {
                alert('Failed to get XP: ' + (data.notification?.body || 'Unknown error'));
                button.textContent = originalText;
                button.disabled = false;
            }
            
        } catch (error) {
            console.error('Error:', error);
            alert('Error getting XP. Check console for details.');
            document.querySelector('#dlp-xp-button').textContent = 'GET XP';
            document.querySelector('#dlp-xp-button').disabled = false;
        }
    }
    
    // Initialize
    setTimeout(addXpButton, 3000);
    
    // Also add on page changes
    let lastUrl = location.href;
    new MutationObserver(() => {
        const url = location.href;
        if (url !== lastUrl) {
            lastUrl = url;
            setTimeout(addXpButton, 3000);
        }
    }).observe(document, {subtree: true, childList: true});
    
})();