Archive for the ‘Python’ Category

Downloading Retro Magazines from Internet Archive


I’ve recently gotten interested in retro-Apple II things. I owned a ][+ and a IIgs as a kid and also experimented with emulators (Applewin and KEGS32) later on.


One of the many magazines I subscribed to back then was Open Apple. It struck just the right balance between being informative and being humorous/witty, in the vein of the Beagle Bros products and literature. (I still remember sending a letter to Bert Kersey and getting a personal response)


The Internet archive has been amassing quite the collection of Apple II material, including scans of books and magazines. I still have a binder somewhere of original Open Apple magazines, but it is much more convenient to read them in pdf form.


I am also quite the python fan, having used it since the 1.x days. There is a python module, internetarchive, that quite effectively allows you to search and download collections from the Internet Archive. Most examples I’ve seen use the command line script ia, but  I (erroneously) thought it would be difficult to get working on a Windows platform. I decided to use the library directly in python to search for and download the entire open apple collection, in pdf (and .epub) format.


What follows is the short program in interactive mode I used. I ran this twice, first without the no_directory parameter in get_item and then with, so that I could have two sets of the collection: one for archival in neat directory structure, and another in one directory to transfer to calibre and eventually my kindles.


>>> from internetarchive import get_item, search_items

>>> search=search_items(‘collection:openapplemagazine’)

>>> search.num_found

>>> for result in search:
…     try:
…         get_item(result[‘identifier’]).download(glob_pattern= ‘*.pdf’, no_directory=True)
…     except: # silently catch all errors (most commonly, IOErrors if file exists already)
…         pass

Another magazine that I remember, but not as fondly as I do Open Apple, is Softalk. The search term for that is collection:softalkapple.



Numpy (scipy) Tip Sheet Saved

This link had a really nice tip/cheat sheet for Numpy arrays. As of today the link appears to be broken, so I have saved it here. The image was unfortunately not saveable, so I have a PDF version of the page.