Skip to content

hirmes/mefi2book

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mefi2book

This node.js script converts a post from Metafilter into a PDF suitable for printing in book form.

Dependencies

Once downloaded, run npm update to get the necessary node modules.

There are two dependencies that need to be installed outside of npm. The first is wkhtmltopdf, which has pre-compiled packages available for easy installation. The second is pdftotext, which is a part of the xpdf suite of tools. I had to download and install it manually, but you may be able to do it with your preferred package management tool.

Usage

Usage: node mefi2book.js [options]

Options:
   -p, --postnumber   The numberic ID of the post, found in its URL. REQUIRED
   -s, --subsite      The subsite. Valid options are www, ask, or metatalk.  Default is  [www]
   -n, --nocache      Ignore cached files  [false]
   --verbose          Output some messages as the script progresses  [false]
   -v, --version      Print version and exit

So, for example if you wanted a book version of the Edward Snowden thread, you would type:

$ node mefi2book.js -p 128901

Your computer will then chug along for 10-60 seconds, and produce a file called www_metafilter_128901.pdf

Bugs

Please note that this script is relatively brittle. If [mathowie] or [pb] decide to change class names or other markup, it could very well break this program.

  • Some older threads that allowed images and had fewer markup restrictions (I'm looking at you 9622) can crash the script

To Do

  • Support different sized books
  • Multiple threads in one book
  • Deal to some degree with comments broken up between pages
  • Generate a book jacket PDF

Licence

GPLv3

About

Convert a Metafilter thread into a print-ready PDF

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published