The following will give you "#1 wallpaper of the day" as decided by the wise folks at Reddit:
curl -A 'random' "https://www.reddit.com/r/wallpaper/top.json?t=day&limit=1 | jq -r '.data.children[0].data.preview.images[0].source.url' | sed 's/preview\./i\./g'
And if you're a Mac user, the following will change the background: osascript -e 'tell application "Finder" to set desktop picture to POSIX file "<path to the picture>"'
Glueing these two pieces should be trivial :)