import scrapers from selenium import webdriver from selenium.common.exceptions import WebDriverException from tqdm import tqdm import json import time import sys OUTPUTFILE = sys.argv[1] driver_options = webdriver.ChromeOptions() driver_options.add_argument("--headless=new") driver_options.add_argument("--window-size=1920,1080") driver = webdriver.Chrome(options=driver_options) datapoints = [] try: for i, cls in enumerate(tqdm( [ scrapers.Minilab, scrapers.TheFilmSafe, scrapers.HarmanLab, scrapers.AGPhotoLab, scrapers.FilmProcessingCoUk, scrapers.PPPCamera, scrapers.AnalogueWonderland, ] )): datapoints += cls(driver).scrape() except WebDriverException as e: driver.save_screenshot(f"crash.{int(time.time())}.png") raise e finally: driver.quit() with open(OUTPUTFILE, "w") as f: json.dump( { "time": int(time.time()), "data": datapoints, "notes": [ { "chemistry": "C41", "format": "35mm", "subformat": "full frame", "note": "Assuming one 36-shot roll of film", }, { "chemistry": "B&W", "format": "35mm", "subformat": "full frame", "note": "Assuming one 36-shot roll of film", }, ], }, f, )