10
$\begingroup$

I'd like to extract all the answers I have written (along with the corresponding questions). In both cases (answers and questions) I'd like to have the original text (including markup) so that I can incorporate this into other LaTeX documents, and I'd like to have any included links and images, too, if possible.

I assume that there is some clever query to do this, but I'm a query neophyte/idiot, so I need detailed step-by-step instructions, please.

I tried some of the queries mentioned in this post. I managed to get the text of my answers, including the links, but I don't see a way to get my pictures.

$\endgroup$
  • $\begingroup$ The pictures are given as links to stackimage, right? I think you'll just have to download those on your own (or write a script that does it for you). Do you have very many images? $\endgroup$ – davidlowryduda Aug 11 '15 at 5:55
  • $\begingroup$ @mixedmath -- 54 images in 805 answers. I can download them one at a time if I have to, but I'd rather not. $\endgroup$ – bubba Aug 11 '15 at 6:03
  • $\begingroup$ Are you on a linux/mac machine, or Windows (or perhaps something else entirely)? If so, then this can be done very simply from a terminal using wget. [I'm afraid I'm not as familiar with Windows machines, but I'm sure it's not so hard to download lists of images on Windows either]. $\endgroup$ – davidlowryduda Aug 11 '15 at 7:32
  • $\begingroup$ Or perhaps superuser.com/questions/274276/… $\endgroup$ – davidlowryduda Aug 11 '15 at 7:34
  • $\begingroup$ @mixedmath -- I'm on a Windows machine. $\endgroup$ – bubba Aug 11 '15 at 8:13
7
$\begingroup$

It just so happens that I did this over the summer (final product). The process wasn't great, but it worked (and I now have a 464-page hardback book of my answers with their associated questions).

General outline of my procedure:

  1. Download the question data using the StackExchange Data Explorer. My query is found here.
  2. Parse the returned HTML with regex (don't kill me); Normal Human's Save as LaTeX utility has some nice regex in the Javascript source.
  3. Use wget and sed to find all links to stack.imgur.com, download the image, and replace the text with the appropriate figure environment.
  4. Use the subfiles package to allow placing each question/answer in its own file.

If I ever get around to streamlining/debugging my Python scripts, I'll post it to GitHub and link it here.

$\endgroup$

You must log in to answer this question.

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