Skip to content

Instantly share code, notes, and snippets.

@edsu
Last active July 6, 2021 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edsu/bf2c74a48ced814c02f4cade378e7de1 to your computer and use it in GitHub Desktop.
Save edsu/bf2c74a48ced814c02f4cade378e7de1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import internetarchive
ia = internetarchive.get_session()
print("ids,pages")
for result in ia.search_items('collection:mediahistory creator:National Association of Educational Broadcasters'):
ia_id = result['identifier']
item = ia.get_item(ia_id)
metadata = item.metadata
# i'm not sure why, but IA's imagecount always seems to be off by one
# greater than the actual number?
cols = [metadata['identifier'], str(int(metadata.get('imagecount', 1)) - 1)]
print(','.join(cols))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment