I needed a script to export long reddit threads (like AMAs) to an ebook so that I can read it on my kindle. I searched for such utility online and found nothing, so I wrote one.
My script (written for nodejs) uses the reddit API to export a thread into a simple html with nested posts and no special formatting. This can then be converted into ebook format of choice using ebook-convert.
How to use
- Install NodeJS and npm
- Clone the sainathadapa/reddit2mobi repo
cd reddit2mobi; npm install
- Run run_reddit2html.js script.
- Pass the url of the reddit post as an argument. Optionally, pass the depth (integer) to limit the maximum depth of subtrees in the thread.
nodejs run_reddit2html.js url depth > out.html
- Pass the url of the reddit post as an argument. Optionally, pass the depth (integer) to limit the maximum depth of subtrees in the thread. - Usage:
- Install Calibre
- Convert the generated html into epub/mobi using the ebook-convert from Calibre.
ebook-convert in.html out.mobi
Sample outputs are available in the github repo
Note: Since I wrote the script, reddit2kindle came up, which does this in an easy and a better way.