Originally Posted by pdurrant
Kindlegen 1.1 and later now always adds the source files used in compiling the kindle ebook as the penultimate record in the kindle ebook.
So I wrote a python script that strips out the sources record from Kindle format ebooks. And for those on Macs I wrote a nice Applescript wrapper and also put the python script in the AppleScript bundle to make things easy.
If you're going to upload to the Amazon store, this script is probably unnecessary, as Amazon will strip the sources before delivery anyway.
But if you're going to upload the ebook somewhere else, (e.g. the MobileRead Library), you might well want to make the file as small as possible.
KevinH has enhanced the original python script to handle newer Kindle format ebooks correctly.
Here they are. A python script, and an AppleScript wrapper around it. If you're on a Mac you only need the Applescript, as it includes the Python script in it. The Applescript is a simple drag&drop operation — drag your KindleGen generated file onto it, and it creates one named [oldname]_stripped.mobi.
As always, please comment with any bug reports or problems.