The following code has been giving me the same output for a long time

Viewed 45

I have been writing some code with PRAW. I want the following to give the top posts each day.But it has been returning the same ids even though new posts are submitted each day and different posts are at the top. What should I do?

import praw  
reddit=praw.Reddit(client_id='id',
               client_secret='secret',password='password',
               user_agent='agent',username='username')


top_funny=subreddit.top(limit=1)
for submission in top_funny:
    print(submission)
2 Answers

by default subreddit.top() returns the top of all time. You can change this by using the time_filter parameter and specify any of the following: hour, day, week, month, year, all.

ex:

subreddit.top("day", limit=1)

will return the top submission from today.

Related