You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Talon Poole 633de3d6ba don't ignore pages.sh 2 years ago
.gitignore don't ignore pages.sh 2 years ago
Makefile v1.0.0 2 years ago
README.md don't ignore pages.sh 2 years ago
images.js v1.0.0 2 years ago
images.sh v1.0.0 2 years ago
package-lock.json v1.0.0 2 years ago
package.json v1.0.0 2 years ago
pages.sh don't ignore pages.sh 2 years ago
parallel.sh v1.0.0 2 years ago

README.md

simpledesktops.com

Usage

install JSDOM with npm install

Then download all the /browse/ pages HTML:

make pages # update Makefile to adjust number (currently 52)

And now you can download all the parsed image URLs to a simple-desktops folder:

make simple-desktops

Optionally add .zip for... that.

(There's a race in breaking the ability to simply run make simple-desktops. I might get around to fixing it but probably not.)

How

The /browse/{page} route lists ~28 images per page whose sources can be extracted from the DOM using:

for (let img of document.querySelectorAll(".desktops img").values()) {
  console.log(img.src)
}

These URLs will have two extensions {filename}.png*.295x184_q100.png.* The second part points to the thumbnail and can be stripped to get the URL for the full size image:

img.src.replace(/\.[^\.]+\.png$/, "")

When a page number outside the range provided by the browser is hit the querySelectorAll will return an empty NodeList the ".more" button will also not be present. Iterating through pages until this happens will collect all the available image URLs.

jsdom enables piping the HTML into a JS file where the above snippets can be used to print the image URLs to stdout. The HTML and the images will be downloaded with curl(1).

https://github.com/jsdom/jsdom