Download 4chan images automatically with this simple script

I like to spice up my desktop with various wallpapers and have to say, that /wg/ on 4chan has been a great provider.
But keeping track of all the images, shifting forth and back and forth again between the 10 pages has been taking too much effort.
So the solution to avoid spilling too much time lurking on that imageboard, I just wrote a bash script. (Sorry Windows users)

Be careful, as this script might run a while before it finishes.
You can modify the script as you like.
You might want to remove the user-agent string or the -nd option or ad a -x for that last wget call, etc…

I’ll post later on how I actually remove the duplicated images 😉
A hint for people eager to know: fdupes

fdupes -r -f . > duplicates && echo ./duplicates > duplicates && rm `cat duplicates`

This would actually throw errors when there are spaces in the filenames.

So it was a long, verry long night.
The spirit driving me was like this:

But in the end, it felt more like: