This file contains 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, subprocess, pathlib | |
SUBREDDIT = "wallpapers" | |
pp = "{}/.prevwall".format(str(pathlib.Path.home())) # this is where the previously used wallpaper links are stored | |
previousImages = [] # This is where the urls of previously used images will be stored | |
r = praw.Reddit(client_id="", | |
client_secret="", | |
user_agent="WallpaperGrabber by /u/ParanoidBox") | |
allowedFormats = ['jpg', 'png'] | |
urls = [post.url for post in r.subreddit(SUBREDDIT).hot(limit=5) if post.url.split(".")[-1] in allowedFormats and !(in previousImages)post.url] |