Created
October 19, 2016 18:36
-
-
Save bag-man/c5fb675187440b2ca262b124587b27df to your computer and use it in GitHub Desktop.
Select and set a random offensive wallpaper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw | |
import random | |
import os | |
from urllib.request import urlretrieve | |
r = praw.Reddit(user_agent='wallpapergrabber') | |
submissions = r.get_subreddit('offensive_wallpapers').get_hot() | |
urls = [] | |
for post in submissions: | |
if (("1920x1080" in post.title) or ("1920 x 1080" in post.title)) and ("i.im" in post.url): | |
urls.append(post.url) | |
urlretrieve(urls[random.randint(0,len(urls))], 'image.jpg') | |
os.system('feh --bg-scale image.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment