parent
e5f29624ff
commit
8452ded609
|
@ -0,0 +1,3 @@
|
|||
used-posts.json
|
||||
*.png
|
||||
*.json
|
|
@ -10,7 +10,7 @@ except ImportError:
|
|||
current_time = time.strftime("%H-%M-%S")
|
||||
current_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
subreddit_name = "r/memes"
|
||||
subreddit_name = "memes"
|
||||
|
||||
nswf = False
|
||||
|
||||
|
@ -29,12 +29,13 @@ reddit = praw.Reddit(client_id="TB3qNrAO2cnRkpmI-Vd8hg",
|
|||
with open(current_path+"/used-posts.json", "r") as used_posts_file:
|
||||
used_posts = json.load(used_posts_file)
|
||||
|
||||
debugging_message("Getting a post from "+subreddit_name)
|
||||
debugging_message("Getting a post from r/"+subreddit_name)
|
||||
subreddit = reddit.subreddit(subreddit_name)
|
||||
hot_post = subreddit.hot()
|
||||
for post in hot_post:
|
||||
posts = subreddit.top(time_filter="day", limit=5)
|
||||
for post in posts:
|
||||
try:
|
||||
if post.id not in used_posts['ids']:
|
||||
print(post.url)
|
||||
if post.url.endswith(".png") or post.url.endswith(".jpg"):
|
||||
debugging_message("Found a new post: "+post.title+" ("+post.id+")")
|
||||
print(post.url)
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"ids": []}
|
||||
{"ids": ["vrcvgn"]}
|
Loading…
Reference in New Issue