Created
August 2, 2026 15:54
-
-
Save Beej126/42628d206f4c5fac70debd136eadbe83 to your computer and use it in GitHub Desktop.
download marathonfoto.com
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
| ``` | |
| msedge.exe --user-data-dir="C:/EdgeDebug" --disable-web-security | |
| ``` | |
| ``` | |
| let imgurls = [...document.querySelectorAll("div#main-photo-gallery div.grid-item img[src^='https://marathonfotothumbs.blob.core.windows.net']")].map(i => i.src); | |
| ``` | |
| ``` | |
| /** | |
| * Batch Download Images from Cross-Origin Blobs | |
| * | |
| * Requirements: | |
| * 1. Run browser with `--disable-web-security` flag to allow cross-origin fetches. | |
| * 2. Pass an array of string URLs. | |
| */ | |
| async function downloadUrlArray(urls, delayMs = 300) { | |
| console.log(`Starting batch download of ${urls.length} images...`); | |
| for (let i = 0; i < urls.length; i++) { | |
| const url = urls[i]; | |
| // Extract base filename and apply 3-digit zero-padded index (e.g. "001_0031.wt.jpg") | |
| const rawName = url.split('/').pop() || `photo.jpg`; | |
| const prefix = String(i + 1).padStart(3, '0'); | |
| const fileName = `${prefix}_${rawName}`; | |
| try { | |
| // 1. Fetch raw image bytes via CORS-bypassed request | |
| const response = await fetch(url); | |
| const blob = await response.blob(); | |
| // 2. Create local Blob URL (forces browser to honor custom filename on a.download) | |
| const blobUrl = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = blobUrl; | |
| a.download = fileName; | |
| document.body.appendChild(a); | |
| a.click(); | |
| document.body.removeChild(a); | |
| // 3. Clean up object URL memory | |
| URL.revokeObjectURL(blobUrl); | |
| } catch (err) { | |
| console.error(`Failed to download #${i + 1} (${url}):`, err); | |
| } | |
| // Pause between iterations to prevent browser throttling | |
| await new Promise(resolve => setTimeout(resolve, delayMs)); | |
| } | |
| console.log(`Finished processing all ${urls.length} images!`); | |
| } | |
| // --- Execution Example --- | |
| // 1. Extract array of image URLs from the DOM | |
| const imgs = [...document.querySelectorAll("div#main-photo-gallery div.grid-item img[src^='https://marathonfotothumbs.blob.core.windows.net']")].map(img => img.src); | |
| // 2. Run the downloader with 300ms pacing | |
| downloadUrlArray(imgs); | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment