#!/usr/bin/env python3 import sys import glob import datetime def index_entity(entity_type, output): now = datetime.date.today().isoformat() print("""""", file=output) print("""""", file=output) for filename in glob.glob(f"sitemap-{entity_type}-*.txt"): print(" ", file=output) print(f" https://scholar.archive.org/{filename}", file=output) print(f" {now}", file=output) print(" ", file=output) print("", file=output) def main(): with open('sitemap-index-works.xml', 'w') as output: index_entity("works", output) with open('sitemap-index-pdfs.xml', 'w') as output: index_entity("pdfs", output) if __name__=="__main__": main()