Alter 3 files

Update `.gitignore`
Update `__main__.py`
Update `__main__.py`
This commit is contained in:
akp 2024-08-26 01:38:05 +01:00
parent 35735466c0
commit 129a2f5605
No known key found for this signature in database
GPG key ID: CF8D58F3DEB20755
3 changed files with 23 additions and 10 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
bundle.zip
index.html
data2.json
### Python ### ### Python ###
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files

View file

@ -103,20 +103,23 @@ with tag("html"):
line("h1", "Film Development Price Comparison", klass="pt-2") line("h1", "Film Development Price Comparison", klass="pt-2")
line("p", "This is my attempt to work out the best value for money film developing and service that's available in the UK. Labs are compared as like-for-like as possible, but some variation (especially in scan size) is inevitable.") line("p", "This is my attempt to work out the best value for money film developing and scanning service that's available in the UK. Labs are compared as like-for-like as possible, but some variation (especially in scan size) is inevitable.")
with tag("p"): with tag("p"):
text("If your favourite/local/whatever lab isn't listed here, ") text("If your favourite/local/whatever lab isn't listed here, ")
line("a", "let me know", href="https://www.akpain.net#contact") line("a", "let me know", href="https://www.akpain.net#contact")
text(" and I'll add it! Likewise, if you want to see E6, ECN2, half frame, 120 or anything else here, please do tell me.") text(" and I'll add it! Likewise, if you want to see E6, ECN2, half frame, 120 or anything else here, please do tell me.")
line( with tag("p"):
"p", text(
"Development costs last updated " "Development costs last updated "
+ datetime.datetime.utcfromtimestamp(raw_data_object["time"]).strftime( + datetime.datetime.utcfromtimestamp(raw_data_object["time"]).strftime(
"%Y-%m-%d %H:%M:%S" "%Y-%m-%d %H:%M:%S"
) )
+ ". Price per pixel figures do not include estimates for outbound or return shipping." + ". Price per pixel figures do not include estimates for outbound or return shipping. "
) )
line("a", "Raw data available here", href="rawdata.json")
text(".")
with tag("div", klass="card", style="width: 18rem;"): with tag("div", klass="card", style="width: 18rem;"):
with tag("div", klass="card-body"): with tag("div", klass="card-body"):

View file

@ -1,29 +1,36 @@
import scrapers import scrapers
from selenium import webdriver from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from tqdm import tqdm from tqdm import tqdm
import json import json
import time import time
import sys import sys
OUTPUTFILE = sys.argv[0] OUTPUTFILE = sys.argv[1]
driver = webdriver.Firefox() 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 = [] datapoints = []
try: try:
for cls in tqdm( for i, cls in enumerate(tqdm(
[ [
scrapers.Minilab,
scrapers.TheFilmSafe, scrapers.TheFilmSafe,
scrapers.HarmanLab, scrapers.HarmanLab,
scrapers.AGPhotoLab, scrapers.AGPhotoLab,
scrapers.FilmProcessingCoUk, scrapers.FilmProcessingCoUk,
scrapers.PPPCamera, scrapers.PPPCamera,
scrapers.AnalogueWonderland, scrapers.AnalogueWonderland,
scrapers.Minilab,
] ]
): )):
datapoints += cls(driver).scrape() datapoints += cls(driver).scrape()
except WebDriverException as e:
driver.save_screenshot(f"crash.{int(time.time())}.png")
raise e
finally: finally:
driver.quit() driver.quit()