import asyncio import gravesong import logging import os import requests import twi loggers = [logging.getLogger()] + [ logging.getLogger(name) for name in logging.root.manager.loggerDict ] for logger in loggers: logger.setLevel(logging.INFO) output_epubs = "output/epubs" output_imgs = "output/imgs" if not os.path.isdir(output_epubs): os.makedirs(output_epubs) if not os.path.isdir(output_imgs): os.makedirs(output_imgs) gravesong_img = requests.get( "https://wanderinginn.files.wordpress.com/2021/12/gravesong-by-boboplushie.jpg" ) with open(f"{output_imgs}/gravesong-by-boboplushie.jpg", "wb") as f: f.write(gravesong_img.content) twi_img = requests.get( "https://i0.wp.com/thefantasyinn.com/wp-content/uploads/2018/08/twi.jpg" ) with open(f"{output_imgs}/twi.jpg", "wb") as f: f.write(twi_img.content) async def main(): await asyncio.gather( gravesong.process( { "creator": "Pirateaba", "language": "en", "publisher": "Xefir", "cover": f"{output_imgs}/gravesong-by-boboplushie.jpg", }, output_epubs, ), twi.process( { "creator": "Pirateaba", "language": "en", "publisher": "Xefir", "cover": f"{output_imgs}/twi.jpg", }, output_epubs, "https://wanderinginn.com/table-of-contents/", ), twi.process( { "creator": "Pirateaba", "language": "fr", "publisher": "Maroti, ElliVia", "cover": f"{output_imgs}/twi.jpg", }, output_epubs, "https://aubergevagabonde.wordpress.com/sommaire/", ), ) asyncio.run(main())