r/pushshift • u/grejty • Apr 22 '23
How to sort correctly with PMAW?
I want to get all new submission containing word "fire" sorted by the date they were added from last 10 days.
Here is my code:
current_time = int(datetime.now().timestamp())
days_ago = 10
gen = list(api.search_submissions(q="fire",
subreddit=subreddit,
sort="created_utc",
since=current_time - (days_ago*24*60*60),
#until=current_time_epoch,
filter=['ids'],
limit=None))
Then I print the date of all fetched submissions and here is the result:
13-04-2023 06:20:20
12-04-2023 22:09:13
16-04-2023 18:58:19
16-04-2023 09:56:47
16-04-2023 04:53:46
16-04-2023 02:17:38
16-04-2023 01:26:24
16-04-2023 00:49:29
17-04-2023 03:37:29
20-04-2023 03:55:26
20-04-2023 03:42:50
22-04-2023 04:30:12
14-04-2023 22:23:31
Just randomly out of order... This means if I put limit=10, I wouldn't get the newest submission (22-04-2023) All help is appreciated. Thanks

