r/pushshift • • Jan 05 '22

API aggregations not working?

Hi guys, I'm using the following code but I can't seem to get the aggs keyword to work properly. It doesn't give me aggregated results, just normal results as if the parameter didn't matter.

Doing something silly probably.

Thanks!

​

def test(search_type = "comment", **kwargs):
base_url = "https: // api.pushshift.io / reddit / search /{}".format(search_type).replace(" ", "")
print(base_url)
data = requests.get(base_url, params = kwargs).json()
print(data)
print(data.get("aggs").get("subreddit"))

test(q = "BTC", after = "30d", size = 1000, aggs = "created_utc")

7 Upvotes

1 comment sorted by

5

u/chaseoes Jan 06 '22

Aggregations haven't worked for a long time. You'll have to do them yourself unfortunately.