Ian Wishart has released his excellent book ‘The Divinity Code‘ onto the wild woolly web. Sign up to issuu & download the document PDF now!

HOWEVER sometimes publishers don’t give you a PDF. You can download the JPGs individually using laborious methods, but come on! You’re using a computer.. a machine that specialises in automating boring tasks. Time for a script methinks.

This little ruby snippet downloads all the JPG files comprising a document from issuu.com, to the local directory. It needs a wee bit of setup. Instructions are provided in the code comments.
NOTE you’ll need ruby installed to use it!

#-------------------------------------------------
# get_issuu.rb - retrieve all jpg's for a document
#-------------------------------------------------

# 1. Open the issuu.com document in your web browser, as usual
#    example: http://issuu.com/iwishart/docs/thedivinity
# 2. Read the document page count; set variable $PAGES below
# 3. From browser menu, choose View > Source
# 4. Do a text search for "documentId" 
# 5. Copy string such as "081230122554-f76b0df1e7464a149caf5158813252d9" 
#    to $PUB variable below
# 6. Execute script:
#    ruby get_issuu.rb

require 'open-uri'
$PUB="081230122554-f76b0df1e7464a149caf5158813252d9"
$PAGES=20

for $X in 1..$PAGES do
  $PX="page_#{$X}.jpg"
  $PADX="page_#{"%03d" % $X}.jpg"
  puts(Time.now.strftime('%Y-%m-%d %X') +" get "+ $PX +">>"+ $PADX)
  open($PADX,"wb").write(open("http://image.issuu.com/#{$PUB}/jpg/#{$PX}").read)
end
puts("#{Time.now.strftime('%Y-%m-%d %X')} DONE")

Hat tip: rubynoob.