Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why can't I query all comments in the last 7 days? #21

Closed
SayonB opened this issue Jul 1, 2021 · 1 comment
Closed

Why can't I query all comments in the last 7 days? #21

SayonB opened this issue Jul 1, 2021 · 1 comment

Comments

@SayonB
Copy link

SayonB commented Jul 1, 2021

Why does this return 0 result(s) available in Pushshift

from pmaw import PushshiftAPI
from datetime import datetime, timedelta

api = PushshiftAPI()
seven_days_ago = (datetime.now() - timedelta(days=7)).timestamp()
comments = api.search_comments(after=seven_days_ago)

>>> 0 result(s) available in Pushshift

while if I directly query pushshift using the same parameters, I get results.

>>> seven_days_ago
>>> 1624497069.970137

https://api.pushshift.io/reddit/comment/search?after=1624497069

In addition: apparently, an integer value is needed, but only works if a subreddit or query term is given

>>> comments = api.search_comments(subreddit="science", after=seven_days_ago)
0 result(s) available in Pushshift
>>> comments = api.search_comments(subreddit="science", after=int(seven_days_ago))
15132 result(s) available in Pushshift
>>> comments = api.search_comments(q="science", after=int(seven_days_ago))
36019 result(s) available in Pushshift
@mattpodolak
Copy link
Owner

mattpodolak commented Jul 4, 2021

Hi @SayonB , yes an integer value is required for the before and after parameters.

but only works if a subreddit or query term is given

I'm not sure what you mean. Can you provide an example query with what you expected to happen and what actually happened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants