Bash one liner that grabs an image from a subreddit and sets it as a wallpaper

I came up with a single bash command line that changes the wallpaper in Gnome to an image grabbed from a subreddit. It takes the top 20 posts on the subreddit and picks the first one that contains a direct imgur link to an image.

It uses feedstail for the rss parsing, you can get it with:

pip install feedstail

You can easily modify it to work with any DE or WM, you can also change the post sorting if you want to or make it into a bash script that you can pass arguments to.

gsettings set org.gnome.desktop.background picture-uri $(feedstail -u "" -n 20 -1 -f "{summary}" | grep -o 'a href="[^<>]*">\[link\]' | grep -o '[^/"]*' | head -n 1)

There is probably ways to improve it or simplify it so feel free to make any suggestions.

Edit: Woops, discovered it was a little buggy, fixed now.