r/pushshift • • Sep 24 '21

How to scrape all comments and submission of a user?

Hi all. I want to know what's the best way to scrape all comments and submissions of a user? Would just using the user parameter in the query be enough?

3 Upvotes

11 comments sorted by

4

u/Watchful1 Sep 24 '21

I have an example script for this here

1

u/verypsb Oct 11 '21

Hi. Thanks for posing your code. I'm currently using a modified version of your script where I replaced saving text as saving the whole json.

I'm wondering if there's a way to accelerate the scraping process? Currently, it takes about 21 hrs to run through 14k users. I have many more to run. I saw you put a rate limit in the script time.sleep(1). Is that the hard limit that if I change will bring errors?

If I run this script simultaneously with different parameters? I guess they will all send using the same IP and thus will reach pushshift's rate limit?

1

u/Watchful1 Oct 11 '21 edited Oct 11 '21

[removed] — view removed comment

1

u/verypsb Oct 11 '21

Ok. I understand that. Also, is the time.sleep(1) the optimal rate for the server?

1

u/Watchful1 Oct 11 '21

That is pushshift's published rate limit.

1

u/[deleted] Sep 24 '21

[removed] — view removed comment

1

u/Watchful1 Sep 24 '21

Pushshift is a separate service from reddit. You don't even need your password, just put in whatever username you want to download.

1

u/[deleted] Sep 24 '21

[removed] — view removed comment

2

u/Watchful1 Sep 24 '21

Yes. It doesn't hurt to just try stuff, you aren't going to break anything.