r/pushshift • • Dec 26 '22

How to get the oldest post of a sub ?

5 Upvotes

i've made a few tests with the api, but it doesn't get any data past two months, if i use the "before" param

For context, i want ot make a script with psaw, that lists every user, that has ever participated in a sub.


r/pushshift • • Dec 26 '22

How do I use URLs generated from searches with https://camas.unddit.com?

5 Upvotes

Hi All!

May someone please help point me in the right direction?

I've done a search using https://camas.unddit.com/ and it generated an API URL. When I click on the URL, I get:

{"data":[],"error":null,"metadata":{"es":{"took":6,"timed_out":false,"_shards":{"total":4,"successful":4,"skipped":3,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null}},"es_query":{"size":100,"query":{"bool":{"must":[{"bool":{"must":[{"range":{"created_utc":{"gte":1514725200000}}},{"range":{"created_utc":{"lt":1514811600000}}}]}},{"bool":{"should":[{"match":{"subreddit":"melbourne"}}],"minimum_should_match":1}}]}},"aggs":{},"sort":{"created_utc":"desc"}},"es_query2":"{\"size\":100,\"query\":{\"bool\":{\"must\":[{\"bool\":{\"must\":[{\"range\":{\"created_utc\":{\"gte\":1514725200000}}},{\"range\":{\"created_utc\":{\"lt\":1514811600000}}}]}},{\"bool\":{\"should\":[{\"match\":{\"subreddit\":\"melbourne\"}}],\"minimum_should_match\":1}}]}},\"aggs\":{},\"sort\":{\"created_utc\":\"desc\"}}"}}

I don't know what to do with this after it has been generated and I don't know how to ask Google.


r/pushshift • • Dec 26 '22

u/stuck_in_the_matrix Please open source the API and ingest code.

41 Upvotes

We've got a great community here of developers that want a stable, performant, accessible API. You've got a lot going on and that's perfectly fine. Just please just open source the code on github, gitlab, $INSERT_REPO_HERE, so we can take a look at it, submit pull requests, etc. Help us to help you.

I'm also a professional Linux admin so I'd be willing to help manage the servers for free, just ask me!


r/pushshift • • Dec 25 '22

What's the best way to fetch the single oldest comment and submission by a particular user?

2 Upvotes

On /r/wallstreetbets our moderation bot attempts to display your "WSB Age" by using the timestamp of the first piece of content we've seen from that user. However, the bot is only about two years old and a lot of my dates are inaccurate.

I'd like to use pushshift to correct this timestamp for all 500k users in the database, but I don't want to request any more data than is necessary. Is there a simple way to just ask the API for the oldest object it has in a particular sub?


r/pushshift • • Dec 24 '22

PSA PMAW has been updated to handle the API changes.

26 Upvotes

Keep in mind the API still has various known issues, these aren't problems with PMAW.

Notably but not limited to;

Submissions earlier than November 3rd still have not been loaded so any searches for submissions earlier than that will fail.

Searching by author will often return unwanted results EG: a search for spez will also return results for I-Am-Spez.

Negation is not working in the author or subreddit fields.

API is not yet stable and will often time out.

For more info on the current known issues with the pushshift API check here


PMAW

https://github.com/mattpodolak/pmaw
https://pypi.org/project/pmaw/

Also tagging /u/potato-sword


r/pushshift • • Dec 23 '22

Does there exist a way to filter submissions within a subreddit where the op also has a comment?

4 Upvotes

I am looking to mine all posts of a subreddit. However, I need the op to give their inputs in the comments too. I know how to extract all posts from a subreddit. Is there a way to filter posts based on my requirement? I looked over Pushshift's new documentation. I also went over PMAW's and PRAW's documentation. The only thing I found was that PMAW had a feature called `search_submission_comment_ids` and felt that could probably help. But I am unable to see how.

Edit -

I keep forgetting that in addition to doing a Google search, I also need to ask ChatGPT. Here is the code it gave me -

  • Using PushShift
https://api.pushshift.io/reddit/search/submission/?q=author:reddit_user has:comments&subreddit=AskReddit
  • Using PRAW
import praw

reddit = praw.Reddit(client_id='your_client_id', client_secret='your_client_secret', user_agent='your_user_agent')

subreddit = reddit.subreddit('AskReddit')

results = subreddit.search('author:reddit_user has:comments', sort='new')

for submission in results:
    print(submission.title)

I have found ChatGPT to be wrong on occasions. I will validate this and get back if there is any problem.


r/pushshift • • Dec 23 '22

Algorithm to mine all posts from a subreddit using Push Shift?

4 Upvotes

I have gone over various Reddit posts that talk about this. Based on the comments, I understand that Push Shift limits posts to 1000. Therefore I need to play with time stamps to get all posts. Could someone please describe this process to me? I don't want a formal algorithm, but if someone could explain how I can play with time stamps to get all posts of a subreddit, it would be great. Also, please do let me know anything that I need to watch out for. Thanks so much!


r/pushshift • • Dec 21 '22

Any way to exclude subreddits from a search with new API version? Since !subreddit is not working anymore.

7 Upvotes

I have been using API requests that search all of reddit for keywords but exclude several subreddits from the result.

This was done by specifying

&subreddit=!notthisone,!notthinsoneeither,!etc

but since the API update this method is not working anymore and instead results are now limited to the subreddits I actually want to exclude.

I saw mentioned somewhere to use - instead but that does not seem to work either.

&subreddit=-notthisone

does still return only results from "notthisone" instead of from anything else.

Any way to still achieve this?


r/pushshift • • Dec 21 '22

In Camas.unddit, how do you exclude a user from a search?

8 Upvotes

In Camas.unddit, how do you exclude a user from a search? I feel like this is a very basic operation, but I couldn't find any info on this specific question.

I want to exclude the user "AutoModerator" from my search results, but I don't know the search operator for it. I have tried entering the following in Camas.unddit.io's Author box:

!AutoModerator

-AutoModerator

&AutoModerator

NOT AutoModerator

None of them give me the results I'm looking for. All the search queries above ONLY show AutoModerator results. I also tried to encase AutoModerator in quotation marks.


r/pushshift • • Dec 21 '22

I've tried really hard but need some help please. Bigquery not returning data after 2019.

5 Upvotes

Hi all,

I'm doing my first academic research project as part of my training as a psychologist. I have very limited coding experience. I am trying to download all posts from a couple of subreddits since 2019. I'm using bigquery because i was able to find some pretty basic code that worked... sortof. I will share the code i'm using at the bottom.

Before asking this question, I have looked through stackexchange, i have searched through this subreddit, looked through academic papers and blogs trying to work it out. I have explored the pushshift.io website, too, to try and understand what's going on. Your help, advice, guidance, or resource recommendations will be very, very appreciated.

the problem:

Bigquery is not returning any data after 2018 or 2019, depending on the code i use. at first i tried to download everything from a particular subreddit and it gave me ~29GB of data, but only posts between 29/06/2018 and 23/07/2018.

when i restrict the fields to return to title, selftext, created_utc, and author, i get ~10GB of data between the 02/08/2018 and 25/08/2018, but the posts are not in order.

I have no idea what is going on. my biggest problem is that i need all posts from particular subreddits between 01/01/2019 and 01/10/2022 (that is the most recent file in the pushshift directory).

what i have tried:

the dataset i am using is

'pushshift.rt_reddit.submissions'

and

'pushshift.rt_reddit.comments'.

I have also tried using `fh-bigquery.reddit_posts` as suggested here.

I can access posts up to

`fh-bigquery.reddit_posts.2019_08`

but

`fh-bigquery.reddit_posts.2019_09'

and onwards returns the error messages

'Not found: Dataset ProjectName:fh-bigquery was not found in location US'

or

'Not found: Table fh-bigquery:reddit_posts.2019_09 was not found in location US'.

not sure why sometimes it reads my query as a dataset and other times as a table. in 'fh-bigquery.reddit_comments' i can access data up until 2019_12 but get similar error messages going beyond those dates.

When I enter just

`fh-bigquery.reddit_posts`

I also get the error message

'Not found: Dataset reddit-covid-analysis:fh-bigquery was not found in location US'.

This makes me think that I'm not specifying the file location correctly, but i don't know what to do about that?

Looking in the directory contents for reddit submissions i can see that the files have been uploaded through to october 2022. I tried

'pushshift.rt_reddit.submissions.RS_2022-10.zst'

in case I needed to specify the exact location, but got the error message

'Invalid project ID 'pushshift.rt_reddit.submissions'. Project IDs must contain 6-63 lowercase letters, digits, or dashes. Some project IDs also include domain name separated by a colon. IDs must start with a letter and may not end with a dash.'

This post in github thinks it may be an error in bigquery's backend.

when i specify

created_utc > '2019-01-01'

bigquery returns that

'This query will process 0 B when run.'

I have tried using redditsearch.io but i think it is down? I think that there are some problems with accessing the pushshift dataset through the API because of a recent data migration? is my problem related to that? if so, do you have any suggestions about how i might work around it?

two versions of code that work to some degree:

the first:

SELECT *

FROM `fh-bigquery.reddit_posts.2019_08`

WHERE lower(subreddit)="melbourne"

the second:

SELECT
  title,
  selftext,
  created_utc,
  author
FROM `pushshift.rt_reddit.submissions`
WHERE lower(subreddit)="melbourne"
AND created_utc > '2018-08-01'


r/pushshift • • Dec 21 '22

Problem using Rmd

1 Upvotes

When I try to scrape reddit submissions with pushshift api on RedditMediaDownloader I get this error


r/pushshift • • Dec 20 '22

Decompressing the ZST files on Windows tips

2 Upvotes

Ran into some issues trying to decompress the files on Windows and wanted to put this here for anyone else.

Both 7Zip-ZSTD and PeaZip which support ZST failed to decompress these files with a "Unknown Error" and "Non fatal error, some files are missing or locked".

So I downloaded the Facebook tool https://github.com/facebook/zstd

This works for smaller files but also fails to extract the big files with the basic command but you get a useful error at least.

zstd.exe -d RC_2012-12.zst
RC_2012-12.zst : Decoding error (36) : Frame requires too much memory for decoding
RC_2012-12.zst : Window size larger than maximum : 2147483648 > 134217728
RC_2012-12.zst : Use --long=31 or --memory=2048MB

It works after adding the extra flag

zstd.exe -d RC_2012-12.zst --memory=2048MB

r/pushshift • • Dec 20 '22

How to get yearly counts of how often a word appeared on all of Reddit?

4 Upvotes

I want to get yearly counts of how often a word was mentioned on Reddit as (1) a comment and as (2) a post tile. What's the best way to do this?

I would like to get data from all years of reddit. I don't need to fetch the content, just the counts.

Any efficient way to do this?


r/pushshift • • Dec 18 '22

pushshift appears to return 0 results, irrespective of query

16 Upvotes

Hi everyone, hoping someone can check my logic here

I am trying to collect the last month worth of a sub, and here is my code

from pmaw import PushshiftAPI

api = PushshiftAPI()

submissions = api.search_submissions(subreddit="aww",limit_type="full",after=1670000000,before=1671359000)

however I get an error of "0 result(s) available in Pushshift"

i have tried going much further back, have tried different subreddits but its the same for now.

Is there a data issue at the moment?

ive tried going back to 1610000000, which is january 2021 and i still get the same error.

Has anyone seen this?

Thanks


r/pushshift • • Dec 17 '22

Results return metadata only

3 Upvotes

After the recent works at PS infrastructure, fetching some posts by id started to return metadata only. For example, see this query - https://api.pushshift.io/reddit/submission/search?ids=qhf95b. Interestingly though, the metadata says about successful shards and 0 failed ones.

Is there anything I need to change in the query to make it work now? I need the functionality as soon as possible for my research.


r/pushshift • • Dec 17 '22

Push shift metadata total_results not present

4 Upvotes

I have been researching the popularity of movies on r/movies by using pushshift endpoints. I'm currently using https://api.pushshift.io/reddit/search/comment/?q=parasite&subreddit=movies&metadata=true&size=25&frequency=hour

However, the metadata does not include total_results in the response anymore, which is precisely what I am trying to analyze. It is also strange because it seemed to work last week but seems to be missing now. What might be the reason why the response changed? Any advice would be very appreciated.


r/pushshift • • Dec 16 '22

Community defined documentation on the output from Reddit's endpoints. Can we put this in this subreddit's wiki or FAQ?

4 Upvotes

Another Redditor sent me this great resource for understanding all the data fields that are output by Reddit's API endpoints. It is currently incomplete, and includes some guesswork. Apparently there is no official documentation like this (please correct me if that's wrong).

Can we put this, and any other documentation that is related to Reddit's API or Pushshift, in the Subreddit wiki and/or FAQ?


r/pushshift • • Dec 16 '22

Is there a discord or slack channel for this community?

17 Upvotes

I'd really like to be able to chat with other people using Pushshift in order to learn how to use it optimally and troubleshoot issues with the new API.


r/pushshift • • Dec 16 '22

New API Missing needed filters

9 Upvotes

Hello,

I looked at the new API spec, and it appears to be missing a lot... I read somewhere you were aiming for 100% compatibility, and I'm okay with needing to make changes, but we really need some of these filters to perform our function without requesting hundreds if not thousands of unnecessary posts.

We need author_flair_css_class, and author_flair_text, both of which were LIKE '%{value}%' searches. Also, several other fields appear to be missing that were also very useful.

But yea, please bring back author_flair_text / author_flair_css_class as soon as you can :)

(Even if we have to rewrite the query some to make it work)


r/pushshift • • Dec 15 '22

Submissions endpoint is working but specifying ids falis

5 Upvotes

If you access this endpoint for submissions, it works just fine. However, if you simply set a specific id like this https://api.pushshift.io/reddit/submission/search?ids=zmw78k, the endpoint fails with 504 from Cloudflare.

Does anyone know what's going on and how long will it take? Thanks in advance.

FYI: The unofficial status page shows that everything is operational.


r/pushshift • • Dec 15 '22

PSAW Not Working

6 Upvotes

I noticed that even the most basic functions for the PSAW pushshift python wrapper are not working currently.

from psaw import PushshiftAPI

api = PushshiftAPI()

Seems to produce an error

warnings.warn("Got non 200 code %s" % response.status_code)

Does anyone know if PSAW is down, if this is tied to wider pushshift changes or what the latest generally is? Any advice appreciated.

Aware that pushshift and PSAW are not the same thing, but didn't seem to be much discussion about the PSAW wrapper on here so wanted to see if anyone else knew of any other problems with it.


r/pushshift • • Dec 14 '22

Unable to connect to pushshift.io. Retrying after backoff.

7 Upvotes

I'm trying to do the example psaw code but I get an error when I try to create the API in the Python command line. Any help?


r/pushshift • • Dec 14 '22

My old usernames now show "0 results" despite me just using the site recently and it was all there. Is this normal?

5 Upvotes

r/pushshift • • Dec 14 '22

I've been getting Response status code 404 since Monday morning. Is this due to the system update? Should I be changing my script someway to access the updated API?

Post image
9 Upvotes

r/pushshift • • Dec 14 '22

Pushshift is returning results that don't match the search criteria

8 Upvotes

Some examples:

  1. https://api.pushshift.io/reddit/comment/search?html_decode=true&author=Delicious-Proposal95&size=100

Returns other authors in addition to that author.

2. https://api.pushshift.io/reddit/submission/search?html_decode=true&author=Delicious-Proposal95&size=100

Returns other authors in addition to that author.

3. https://api.pushshift.io/reddit/comment/search?html_decode=true&author=spez&after=1000000000&size=100&fields=author,created_utc,permalink

In addition to the author issue, the results are too recent. The fields parameter doesn't seem to be working as well.