Created
October 24, 2025 15:24
-
-
Save Harry260/5078ac94710215b03f56c331c8b9af3f to your computer and use it in GitHub Desktop.
Download Brilliant Read Only Notes [v2] (Testpress)
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 characters
| (async () => { | |
| const iframeSrcs = Array.from(document.querySelectorAll('iframe')) | |
| .map(i => i.src) | |
| .filter(Boolean); | |
| const viewerPattern = /^https:\/\/media\.testpress\.in\/static\/js\/pdf_js_v3_10_111\/web\/viewer\.html\?/; | |
| const matchingSrcs = iframeSrcs.filter(src => viewerPattern.test(src)); | |
| for (const src of matchingSrcs) { | |
| try { | |
| const urlObj = new URL(src); | |
| const fileParam = urlObj.searchParams.get('file'); | |
| if (!fileParam) continue; | |
| const decodedFileUrl = decodeURIComponent(fileParam); | |
| const a = document.createElement('a'); | |
| a.target= "_blank" | |
| a.href = decodedFileUrl; | |
| a.download = decodedFileUrl.split('/').pop().split('?')[0]; | |
| document.body.appendChild(a); | |
| a.click(); | |
| document.body.removeChild(a); | |
| } catch (err) { | |
| console.error("Error:", src, err); | |
| } | |
| } | |
| console.log("%cBy Harry (GitHub.com/Harry260)", "color: #00c896; font-weight: bold;"); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment