film-dev-cost-scraper/scraper/__main__.py
AKP 129a2f5605
Alter 3 files
Update `.gitignore`
Update `__main__.py`
Update `__main__.py`
2024-08-26 01:38:05 +01:00

58 lines
1.5 KiB
Python

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,
)