Last active
July 6, 2021 14:39
-
-
Save edsu/bf2c74a48ced814c02f4cade378e7de1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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