Norwegian newspaper Aftenposten has started testing an e-book reader version in cooperation with Digitalbok.no. Having recently acquired a Kindle I welcome the e-book version and hope more Norwegian newspapers will follow.

Unfortunately for Kindle users Aftenposten does not (yet) make use of the excellent delivery support within Amazons Whispernet. For a subscription fee, Amazon delivers new editions of magazines and newspapers to your Kindle as soon as they are available.

Another issue (for Kindle users) is that Aftenpostens e-book version is delivered in the open but unsupported ePub format.

But fear not, this post will describe how to set up an automatic delivery of Aftenposten from Digitalbok.no to your Kindle. And guess what, Aftenposten beta is currently free of charge!

Ingredients:

  • A linux machine
  • Cron
  • Scala
  • Mutt
  • Wget

The steps:

  1. Download today's version of the newspaper
  2. Extract the contents of ePub file
  3. Make some necessary transformations on the metadata.opf and contents.html
  4. Rebuild a kindle friendly ePub file.
  5. Transform ePub to kindle supported .mobi format
  6. Send newspaper to your kindle using your kindle e-mail address.

Steps 2-4 are needed since Aftenposten does not put the sections in the same order in metadata.opf and toc.ncx. The script will rebuild the faulty spine section in metadata.opf from toc.ncx allowing no error.

Changes to contents.html are optional, but being able to navigating to different sections from the front page is really nice. More transformations could surely be done to pleasant the Kindle reading experience. Suggestions are welcome.

The Scala file will need to be compiled to the bin folder.scalac -d ~/aftenposten/bin FixAftenposten.scala

Set the permissions to execute the script:

chmod 755 ~/aftenposten/aftenposten.sh

Download KindleGen

wget http://s3.amazonaws.com/Fkindlegen/kindlegen_linux_2.6_i386_v1.1.tar.gz
tar -xzf kindlegen_linux_2.6_i386_v1.1.tar.gz -C ~/aftenposten/bin kindlegen

Add an entry to the crontab

Run once an hour from 6 in the morning until today's edition has been published:
crontab -e
0 6-18 * * 1-5 /home/[username]/aftenposten/aftenposten.sh

You should add the servers e-mail to the "allow list" for your kindle at: http://www.amazon.com/myk