Created
May 2, 2024 02:31
-
-
Save emersonlaurentino/0da297cc5a92e9f587d03f34b6d2b0c8 to your computer and use it in GitHub Desktop.
alboompro
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
/** | |
* Before running this code, you need to run this script on the web page: | |
* urls = [] | |
document.querySelectorAll(".src-components-Client-Common-___Common__photo___3yTw5 > img").forEach((item) => { | |
const url = item.src.replace("alfred.alboompro.com/resize/width/300/url/", "") | |
if (!urls.includes(url)) { | |
urls.push(url) | |
} | |
}) | |
* after that, copy the urls array and paste it in the urls variable below | |
* then run the code | |
*/ | |
const urls = [""]; | |
function downloadPhotos(urls: string[]) { | |
urls.forEach(async (url, index) => { | |
const fileName = `photo-${index + 1}.jpg`; | |
console.log("start downloading: ", fileName); | |
const result = await fetch(url); | |
await Bun.write(`imgs/${fileName}`, result); | |
console.log("downloaded: ", fileName); | |
}); | |
} | |
downloadPhotos(urls); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment