-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathscript.js
More file actions
17 lines (13 loc) · 613 Bytes
/
Copy pathscript.js
File metadata and controls
17 lines (13 loc) · 613 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var allDownloadLinks = document.links;
var downloaded = 0;
var downloadedArr = [];
for (var i = 0; i < allDownloadLinks.length; i++) {
if (allDownloadLinks[i].getAttribute("href").startsWith("https://unsplash.com/photos/") && allDownloadLinks[i].getAttribute("href").endsWith("/download?force=true")) {
if (!downloadedArr.includes(allDownloadLinks[i].getAttribute("href"))) {
window.open(allDownloadLinks[i].getAttribute("href"));
downloaded++;
downloadedArr.push("allDownloadLinks[i].getAttribute('href')");
}
}
}
console.log("Successfully downloaded " + downloaded + " Unsplash images.");