Web-to-mobi - A script for converting web sites to mobipocket format

I've written a script to convert Getting Real into mobipocket format.

But the kindle edition of Getting Real is sold at amazon.com, publishing this script may be illegal.

So I've re-written this script like this following the advice from @otsune-san.

This script gets JSON data about a web site from STDIN and converts web data to mobipcoket format.

JSON data format is like this.

{
     "title"    : "Getting Real",
     "author"   : "37signals",
     "chapters" : [
         {
             "title"     : "Introduction",
              "sections" : [
                  {
                      "title" : "What is Getting Real?",
                      "uri"   : "http://gettingreal.37signals.com/ch01_What_is_Getting_Real.php"
                  },
                  {
                      "title" : "About 37signals",
                      "uri"   : "http://gettingreal.37signals.com/ch01_About_37signals.php"
                  },
              ]
        }
     ],
     "content_xpath" : "//div[@class=\"content\"]",
     "exclude_xpath" : "//div[@class=\"next\"]"
}

This is the image of showing the converted file on Kindle Previewer.