Last active
August 5, 2023 19:41
-
-
Save Klaster1/dd7991d59fc8e6a7ec2544b47a12e4e9 to your computer and use it in GitHub Desktop.
Revisions
-
Klaster1 revised this gist
Oct 7, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ==UserScript== // @name Rarbg captcha solver // @version 1.2 // @grant none // @match https://*/threat_defence.php?defence=2* // @require https://unpkg.com/tesseract.js@v2.1.0/dist/tesseract.min.js -
Klaster1 revised this gist
Oct 7, 2022 . 1 changed file with 24 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,23 +19,38 @@ const waitForImage = async (img) => { await new Promise(resolve => img.addEventListener('load', resolve)) } /** * @param {HTMLImageElement} img */ const imageToDataURL = async (img) => { const canvas = document.createElement('canvas') canvas.width = img.width canvas.height = img.height const ctx = canvas.getContext('2d') ctx.drawImage(img, 0, 0) return canvas.toDataURL() } /** * @param {string} url * @returns Promise<string> */ const solveImageAtURL = async (url) => { const worker = Tesseract.createWorker(); await worker.load(); await worker.loadLanguage('eng'); await worker.initialize('eng'); const { data: { text } } = await worker.recognize(url); await worker.terminate(); return text } (async () => { /** * @type {HTMLImageElement} */ const img = document.querySelector('img[src*="captcha"]') await waitForImage(img) document.querySelector('#solve_string').value = await solveImageAtURL(await imageToDataURL(img)) document.querySelector('form').submit() })() -
Klaster1 revised this gist
Oct 7, 2022 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ==UserScript== // @name Rarbg captcha solver // @version 1.1 // @grant none // @match https://*/threat_defence.php?defence=2* // @require https://unpkg.com/tesseract.js@v2.1.0/dist/tesseract.min.js @@ -11,8 +11,20 @@ // @updateURL https://gist.github.com/Klaster1/dd7991d59fc8e6a7ec2544b47a12e4e9/raw/rarbg-captcha-solver.user.js // ==/UserScript== /** * @param {HTMLImageElement} img */ const waitForImage = async (img) => { if (img.complete) return await new Promise(resolve => img.addEventListener('load', resolve)) } (async () => { /** * @type {HTMLImageElement} */ const img = document.querySelector('img[src*="captcha"]') await waitForImage(img) const canvas = document.createElement('canvas') canvas.width = img.width canvas.height = img.height -
Klaster1 revised this gist
Oct 7, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ // @run-at document-idle // @author Klaster_1 // @icon https://rarbgenter.org/favicon.ico // @downloadURL https://gist.github.com/Klaster1/dd7991d59fc8e6a7ec2544b47a12e4e9/raw/rarbg-captcha-solver.user.js // @updateURL https://gist.github.com/Klaster1/dd7991d59fc8e6a7ec2544b47a12e4e9/raw/rarbg-captcha-solver.user.js // ==/UserScript== (async () => { -
Klaster1 created this gist
Oct 7, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ // ==UserScript== // @name Rarbg captcha solver // @version 1 // @grant none // @match https://*/threat_defence.php?defence=2* // @require https://unpkg.com/tesseract.js@v2.1.0/dist/tesseract.min.js // @run-at document-idle // @author Klaster_1 // @icon https://rarbgenter.org/favicon.ico // ==/UserScript== (async () => { const img = document.querySelector('img[src*="captcha"]') const canvas = document.createElement('canvas') canvas.width = img.width canvas.height = img.height const ctx = canvas.getContext('2d') ctx.drawImage(img, 0, 0) const worker = Tesseract.createWorker(); await worker.load(); await worker.loadLanguage('eng'); await worker.initialize('eng'); const { data: { text } } = await worker.recognize(canvas.toDataURL()); document.querySelector('#solve_string').value = text await worker.terminate(); document.querySelector('form').submit() })()