20

How do I download all of my questions and answers across all of the sites in the network?

And is there a way that could preserve special LaTeX formatting?

5

2 Answers 2

11

At the moment, the easiest way is to download the data dumps. Getting the data out of that then becomes a problem (query on your user number for each site), but the easiest way to get ahold of the data, especially with all formatting intact, is to download the dumps.

You can also write a script using the API to do the same thing, but that's more work up front. However, you'll only get what you need, whereas the data dump gives you much more than you need. You can peruse the library of existing apps built on the API to help you get close to what you want.

There are many other ways to grab the data, but the engine actively resists robots and screen scrapers, so it's harder to get the data off the site using normal site grabbing tools.

4
  • Doesn't this only cover graduated sites? All of the sites I'm most active on are beta sites. Commented Sep 27, 2012 at 5:32
  • The dump indeed only covers "all public non-beta Stack Exchange Sites" (source). Commented Nov 26, 2013 at 17:42
  • 1
    The data dumps now include beta sites. Commented Jan 15, 2017 at 18:51
  • I wrote a Python script that does this all in one step: it downloads all of your questions and answers across all SE sites and writes them into Markdown files in sub-directories. The code, with instructions on how to use it, can be found here: github.com/mhdadk/stack-exchange-backup
    – mhdadk
    Commented Jan 28 at 14:48
7

You can use the Data Explorer and run this query:

-- Display all questions+answers of a given user

DECLARE @UserId int = ##UserId##

SELECT Posts.Body
FROM Posts
WHERE Posts.OwnerUserId = @UserId

The main issue is that it needs to be run for each Stack Exchange website you want to retrieve your questions+answers from, which can be pretty tedious to do. Also, the output is in CSV format.


A much better alternative: this SEDE query Dump of my own Stack Exchange content

3
  • 1
    I entered my userID but none of my own questions are coming up, how exactly do I do this? can you please provide more detail?
    – user321525
    Commented Apr 15, 2016 at 17:32
  • @Jonathan Did you choose a Stack Exchange website where you posted a question? If so, keep in mind that the data explorer is updated only once a week approximately. Commented Apr 15, 2016 at 21:21
  • 1
    I wrote a Python script that does this all in one step: it downloads all of your questions and answers across all SE sites and writes them into Markdown files in sub-directories. The code, with instructions on how to use it, can be found here: github.com/mhdadk/stack-exchange-backup
    – mhdadk
    Commented Jan 28 at 14:45

Not the answer you're looking for? Browse other questions tagged .