January 29, 2019
Illustration by loornicolas
There are some cool wallpapers on r/wallpapers. Earlier this year, I started saving them on a folder on my computer in order to display them on my desktop in a random fashion.
This picking and downloading process was kind of tedious, so Iβve built a small Node.js program to automate it.
π The program is available here.
The way it works is very simple: It grabs the URL of the specified subreddit, adds some user defined variables and fetches it adding a .json
extension.
Itβs so nice of Reddit to make things so easy by exposing the whole content of any page in JSON form by just adding a .json
extension. E.G., https://www.reddit.com/r/wallpapers/top returns a normal page but https://www.reddit.com/r/wallpapers/top.json returns the whole content in JSON form.
After that, it is just a matter of finding and filtering the image URL in the JSON content and downloading it.
Written by Jon Portella.