Ruby script: download document JPGs from ISSUU

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, 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 document in your web browser, as usual
#    example:
# 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'

for $X in 1..$PAGES do
  $PADX="page_#{"%03d" % $X}.jpg"
  puts('%Y-%m-%d %X') +" get "+ $PX +">>"+ $PADX)
puts("#{'%Y-%m-%d %X')} DONE")

Hat tip: rubynoob.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s