Downloading content from Gale-Cengage

1

Here is a very simple script written in Python. It downloads all the images of one or several books into the directory where the script is.  Unfortunately WordPress does not allow to upload the script (either in .py or .txt), so here it is. → are for indentations.

Remember that, depending on the content set (see here), the images are either in .tiff or in .jpg.

 

import urllib2

#set the list of books you want to download. For this script, we start from each book's first page, i.e the book id+00010
idlist = ['012000180000010',
'040930080000010']

for i in idlist:

→end=int(i)+99990
→while int(i) <= end :

→→url = "http://callisto.ggsrv.com/imgsrv/Fetch?recordID="+str(i)+"&contentSet=ECLW"

→→print url
→→try:
→→→req = urllib2.Request(url)

→→→req.add_header('User-agent', 'Mozilla 5.10')
→→→dl = urllib2.urlopen(req)

→→→with open(str(i)+'.tiff', 'wb') as f:
→→→→while True:
→→→→→content = dl.read()
→→→→→if not content: break
→→→→→f.write(content)

→→except urllib2.HTTPError:

→→→break

→→i=int(i)+10

One thought on “Downloading content from Gale-Cengage

  1. […] you have used a small script and downloaded the 120 pages of the book you are interested in (and want to liberate). Good for […]

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: