Created
June 7, 2021 10:35
-
-
Save mubbo/81273206a2bad430b4bfc4f00f9d5e96 to your computer and use it in GitHub Desktop.
download images from shopify shop
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
function fetchPageAssets() { | |
let images = document.querySelectorAll('img[src*=files]'); | |
images.forEach(function(image) { | |
files.push('<a href="' + image.src.replace(/_60x60/, "") + '"><img src="' + image.src.replace(/_60x60/, "") + '">'); | |
}); | |
} | |
function downloadListFile() { | |
let button = document.createElement("a"); | |
let data = 'data:application/octet-stream;base64,' + window.btoa(files.join('\n')); | |
button.id = "download-file"; | |
button.href = data; | |
button.download = "shopify-files.html"; | |
document.querySelector("body").append(button); | |
button.click(); | |
} | |
var files = [] | |
files.push('\n') | |
fetchPageAssets() | |
files.push('\n\n') | |
downloadListFile() |
So Awesome. Thanks Gary!!!!
@mubbo : do you know what needs to be edited in this script to include mp4 and svg files?
That worked a treat! Thank you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
legend