Free-Doge.io Auto Faucet

Automatically claims from free-doge.io faucet with AI captcha solving

Size

7.8 KB

Version

1.0.1

Created

Nov 3, 2025

Updated

11 days ago

1// ==UserScript==
2// @name		Free-Doge.io Auto Faucet
3// @description		Automatically claims from free-doge.io faucet with AI captcha solving
4// @version		1.0.1
5// @match		https://*.free-doge.io/*
6// @icon		https://greasyfork.org/vite/assets/blacklogo16-DftkYuVe.png
7// ==/UserScript==
8(function() {
9    'use strict';
10
11    console.log('Free-Doge.io Auto Faucet started');
12
13    // Configuration
14    const CONFIG = {
15        checkInterval: 5000, // Check every 5 seconds
16        retryDelay: 60000, // Wait 60 seconds before retry after claim
17        maxRetries: 3
18    };
19
20    // State management
21    let isProcessing = false;
22    let retryCount = 0;
23
24    // Debounce function to prevent multiple simultaneous executions
25    function debounce(func, wait) {
26        let timeout;
27        return function executedFunction(...args) {
28            const later = () => {
29                clearTimeout(timeout);
30                func(...args);
31            };
32            clearTimeout(timeout);
33            timeout = setTimeout(later, wait);
34        };
35    }
36
37    // Get captcha image as base64
38    async function getCaptchaImage() {
39        try {
40            const captchaImg = document.querySelector('img.captchaownhomepage#captchaimg');
41            if (!captchaImg || !captchaImg.src) {
42                console.log('Captcha image not found');
43                return null;
44            }
45
46            console.log('Found captcha image:', captchaImg.src);
47            return captchaImg.src;
48        } catch (error) {
49            console.error('Error getting captcha image:', error);
50            return null;
51        }
52    }
53
54    // Solve captcha using AI
55    async function solveCaptcha(imageUrl) {
56        try {
57            console.log('Solving captcha with AI...');
58            
59            const prompt = `You are a captcha solver. Look at this captcha image and extract the text from it. 
60The image URL is: ${imageUrl}
61
62Please analyze the image and return ONLY the text you see in the captcha. 
63The text is usually alphanumeric characters. Return only the characters, nothing else.`;
64
65            const result = await RM.aiCall(prompt, {
66                type: "json_schema",
67                json_schema: {
68                    name: "captcha_solution",
69                    schema: {
70                        type: "object",
71                        properties: {
72                            text: { 
73                                type: "string",
74                                description: "The text extracted from the captcha image"
75                            },
76                            confidence: {
77                                type: "number",
78                                description: "Confidence level from 0 to 1",
79                                minimum: 0,
80                                maximum: 1
81                            }
82                        },
83                        required: ["text"]
84                    }
85                }
86            });
87
88            console.log('AI captcha solution:', result);
89            return result.text;
90        } catch (error) {
91            console.error('Error solving captcha with AI:', error);
92            return null;
93        }
94    }
95
96    // Fill captcha input and click roll button
97    async function submitClaim(captchaText) {
98        try {
99            const captchaInput = document.querySelector('input#captchainput[name="captcha_challenge"]');
100            const rollButton = document.querySelector('button.btn.btn-lg.btn-success[type="button"]');
101
102            if (!captchaInput || !rollButton) {
103                console.error('Captcha input or roll button not found');
104                return false;
105            }
106
107            console.log('Filling captcha input with:', captchaText);
108            captchaInput.value = captchaText;
109            
110            // Trigger input event
111            captchaInput.dispatchEvent(new Event('input', { bubbles: true }));
112            captchaInput.dispatchEvent(new Event('change', { bubbles: true }));
113
114            console.log('Clicking roll button...');
115            await new Promise(resolve => setTimeout(resolve, 500));
116            rollButton.click();
117
118            console.log('Claim submitted successfully');
119            return true;
120        } catch (error) {
121            console.error('Error submitting claim:', error);
122            return false;
123        }
124    }
125
126    // Check if we can claim
127    function canClaim() {
128        const rollForm = document.querySelector('div#rollform');
129        const captchaImg = document.querySelector('img.captchaownhomepage#captchaimg');
130        const rollButton = document.querySelector('button.btn.btn-lg.btn-success[type="button"]');
131        
132        return rollForm && captchaImg && rollButton && !isProcessing;
133    }
134
135    // Main auto-claim function
136    async function autoClaim() {
137        if (isProcessing) {
138            console.log('Already processing, skipping...');
139            return;
140        }
141
142        if (!canClaim()) {
143            console.log('Cannot claim yet, waiting...');
144            return;
145        }
146
147        isProcessing = true;
148        console.log('Starting auto-claim process...');
149
150        try {
151            // Get captcha image
152            const captchaImageUrl = await getCaptchaImage();
153            if (!captchaImageUrl) {
154                console.error('Failed to get captcha image');
155                isProcessing = false;
156                return;
157            }
158
159            // Solve captcha
160            const captchaText = await solveCaptcha(captchaImageUrl);
161            if (!captchaText) {
162                console.error('Failed to solve captcha');
163                retryCount++;
164                
165                if (retryCount < CONFIG.maxRetries) {
166                    console.log(`Retrying... (${retryCount}/${CONFIG.maxRetries})`);
167                    isProcessing = false;
168                    setTimeout(autoClaim, 2000);
169                } else {
170                    console.log('Max retries reached, waiting for next cycle');
171                    retryCount = 0;
172                    isProcessing = false;
173                }
174                return;
175            }
176
177            // Submit claim
178            const success = await submitClaim(captchaText);
179            if (success) {
180                console.log('Claim process completed, waiting for result...');
181                retryCount = 0;
182                
183                // Wait and check for success/error messages
184                setTimeout(() => {
185                    isProcessing = false;
186                    console.log('Ready for next claim cycle');
187                }, CONFIG.retryDelay);
188            } else {
189                console.error('Failed to submit claim');
190                isProcessing = false;
191            }
192
193        } catch (error) {
194            console.error('Error in auto-claim process:', error);
195            isProcessing = false;
196        }
197    }
198
199    // Observe DOM changes to detect when form is ready
200    const observer = new MutationObserver(debounce(() => {
201        if (canClaim() && !isProcessing) {
202            console.log('Form detected, starting auto-claim...');
203            autoClaim();
204        }
205    }, 1000));
206
207    // Initialize
208    function init() {
209        console.log('Initializing Free-Doge.io Auto Faucet...');
210        
211        // Start observing DOM changes
212        observer.observe(document.body, {
213            childList: true,
214            subtree: true
215        });
216
217        // Initial check
218        if (document.readyState === 'complete') {
219            setTimeout(autoClaim, 2000);
220        } else {
221            window.addEventListener('load', () => {
222                setTimeout(autoClaim, 2000);
223            });
224        }
225
226        // Periodic check
227        setInterval(() => {
228            if (canClaim() && !isProcessing) {
229                autoClaim();
230            }
231        }, CONFIG.checkInterval);
232
233        console.log('Auto Faucet initialized successfully');
234    }
235
236    // Start the extension
237    init();
238
239})();
Free-Doge.io Auto Faucet | Robomonkey