Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Wikimedia Commons status update script
import internetarchive.api as iaapi
import humanize
def extract(x):
s = x.identifier.split('-',1)
date = s[1] if '-' in s[1] else s[1][:4]+'-'+s[1][4:]
return ' |-\n | ' + ' || '.join((date, '{{IA id|'+x.identifier+'}}', str(x.files_count), humanize.naturalsize(x.item_size)))
rows=map(extract, w.contents())
output = """
{| class="wikitable sortable"
! Date !! Identifier !! Files !! Size
|}""" % ('\n'.join(rows))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment