1 comment

[ 1.8 ms ] story [ 15.1 ms ] thread
This may be weird... but this downloads all the books (just find and extract out all the links to a file) import urllib2 import urllib

f = open('file.txt') CHUNK = 16 * 1024 for line in f: req = urllib2.urlopen(line) file = req.geturl().split('/')[-1] file = urllib.unquote(file) if '.pdf' in file[len(file)-4:]: with open(file, 'wb') as fp: while True: chunk = req.read(CHUNK) if not chunk: break fp.write(chunk)