Skip to content

Instantly share code, notes, and snippets.

View balbuf's full-sized avatar
🍕
thinking about pizza

Stephen Beemsterboer balbuf

🍕
thinking about pizza
View GitHub Profile
@balbuf
balbuf / zenfolio-photo-downloader.js
Last active December 10, 2022 23:16 — forked from robwalkerco/zenfolio-photo-downloader.js
Zenfolio photo downloader
(async () => {
const link = document.createElement('a');
document.body.appendChild(link);
// loop through matching images
for (const image of document.querySelectorAll('.pv-inner img:first-child')) {
const path = image.style.backgroundImage.split('"')[1].replace(/-\d.jpg/, '-5.jpg');
// filename of the image
link.download = new URL(path).pathname.replace(/^.*\//, '');
// fetch the image, convert it to a data URL, set as the href of the link element