Is it possible to get database dumps of EA Forum content? I think it would be useful for data analysis, such as building a topic model of EA causes and estimating how much the forum talks about them.
[Question] Database dumps of the EA Forum
- 2 Jan 2022 0:16 UTC; 4 points) 's comment on Open Thread: Spring 2022 by (
- 22 Nov 2021 23:09 UTC; 3 points) 's comment on The Case for Reducing EA Jargon & How to Do It by (
I recently used GraphQL to download all comments and posts, here and on LW, and the code I used is on github.
Really curious to see what you’re going to do with it!
Btw, I think we should use https://forum-bots.effectivealtruism.org/graphql for automated queriesReally curious to see what you’re going to do with it!
https://www.jefftk.com/p/linking-alt-accounts
Thanks, I’d missed that! If I ever do more scraping I’ll use that instead: commmit.
We have a GraphQL interface that people can use to scrape Forum data.
We block web crawlers from the All Posts page so that they don’t click “load more” a thousand times and slow down the site. But you can use your own crawlers on the page if you’re willing to click “Load More” a lot.
Let me know if you have more questions, and I’ll make sure they get answered (that is, I’ll ask the tech team).
You don’t need to use the allPosts page to get a list of all the posts. You can just ask the GraphQL API for the ids of all of them.
If someone wants to put up an extract of the data on Kaggle or Github it might be useful.
I was trying out OpenAI Codex after getting access this morning and the task of getting EA Forum data seems ideal for testing it out.
Using Codex, I got code that seems like it downloads plain text comments from the forum at the rate of thousands per minute.
It’s a lot faster than writing the script by hand, and does nice things quickly (see time zone fixing).
I thought it was neat!
(This isn’t hardcore code, but in case the OP, or anyone else needs raw forum data, and doesn’t feel like writing the snippets, feel free to comment or send a message.)
Here’s a picture OpenAI interface with the “prompt”:
Actual Code (bottom half generated by OpenAI Codex):
Here’s an example of the output.
Notes:
You need to provide a GraphQL query to get Codex to work, it isn’t going to figure it out. A tutorial for creating GraphQL is here. I made a simple query to get comments, as you can see above. The interface for GraphQL seems pretty good and you can create queries to get posts and a lot of other information.
I haven’t let this run to try to get the “entire forum”. API/backend limits or other issues might block this.
I can see there’s at least one error in my GraphQL query, I think
PostedAt
gives a timestamp for the post, not the comment. There’s other typos (I spent 10x more time writing this forum comment than writing the instructions for Codex to generate the code!)Here is some code you can use to get the most essential data from all the forum posts: https://github.com/filyp/tree-of-tags/blob/main/tree_of_tags/forum_queries.py
Also, I used that data to build a topic model of the forum as you mentioned. You can see it here
I tried running this code, but it sends a query that gets:
Looking at ForumMagnum code this is:
It looks like how
tree_of_tags
works, with anoffset
that keeps increasing bychunk_size
isn’t compatible with the current forum API.When I tried repurposing this code I got a similar error, so that portion in my code now looks like this:
So ~3000 seemed to be a fine chunksize to get every post, and I use the date strings to iterate through the dates to get all posts in postedAt order.
Thanks! I tried extending this for comments, but it looks like it ignores terms; filed an issue.