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

Score parameters #20

Closed
Hastte opened this issue Jun 5, 2021 · 5 comments
Closed

Score parameters #20

Hastte opened this issue Jun 5, 2021 · 5 comments

Comments

@Hastte
Copy link

Hastte commented Jun 5, 2021

Hello
When i try api.search_submissions(subreddit="science", limit=None, score>=1000
I get an error SyntaxError: positional argument follows keyword argument
Do you know how to fix it ?
Thanks

@mattpodolak
Copy link
Owner

mattpodolak commented Jun 5, 2021

Hi @Hastte, can you try the following: api.search_submissions(subreddit="science", limit=None, score=">1000")

Let me know if this works

@Hastte
Copy link
Author

Hastte commented Jun 5, 2021

Yes that's kinda work buuut, i get less result than usual using pushshift api directly
Edit: when i put the limit to 20k for exemple, i got 20 results and if i put the limit to 10k i got 200 result BUT with 40 above 20k

@mattpodolak
Copy link
Owner

Can you share your queries?

I tested the score parameter and got the results I expected, using Pushshift directly we can see 16 results exist (https://api.pushshift.io/reddit/search/submission/?q=dodo%20bird&metadata=true&score=%3E1000).

        "execution_time_milliseconds": 98.48,
        "index": "rs",
        "metadata": "true",
        "q": "dodo bird",
        "ranges": [],
        "results_returned": 16,
        "score": [
            ">1000"
        ],
        "shards": {
            "failed": 0,
            "skipped": 0,
            "successful": 24,
            "total": 24
        },
        "size": 25,
        "sort": "desc",
        "sort_type": "created_utc",
        "timed_out": false,
        "total_results": 16

Using the same query, re-written in pmaw, we get 16 results:

posts = api.search_submissions(q="dodo bird", score=">1000") # reports 16 available results
len(posts) # 16

@Hastte
Copy link
Author

Hastte commented Jun 5, 2021

image
image
image

And now it's the opposite

@mattpodolak
Copy link
Owner

mattpodolak commented Jun 5, 2021

Your score parameter for Pushshift is malformed, "score>20000" should be "score=>20000".

This is the correct query: https://api.pushshift.io/reddit/search/submission/?subreddit=science&metadata=true&score=%3E20000

It has the same number of results as pmaw so I will be closing this issue.

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