Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wikimedia Commons status update script
import internetarchive.api as iaapi
import humanize
w=iaapi.get_item('wikimediacommons')
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
%s
|}""" % ('\n'.join(rows))
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.