From 59e75fb58ea26f23f83e80f824210be058615634 Mon Sep 17 00:00:00 2001 From: Alex Kretzschmar Date: Wed, 15 May 2024 09:04:42 -0400 Subject: [PATCH] adds a basic try except block to catch LUP feed error --- .gitignore | 1 + requirements.txt | 2 +- scrape.py | 10 +++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b23035e..0246446 100644 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,7 @@ $RECYCLE.BIN/ env/ output/ +venv/ # This will fail in 2100, but i'm ok with that #docs/**/20*/ diff --git a/requirements.txt b/requirements.txt index 824b56f..0c5d720 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ mkdocs-material==7.2.8 mkdocs-material-extensions==1.0.1 pymdown-extensions==8.2 html2text==2020.1.16 -pyyaml==5.4.1 +pyyaml==6.0.1 python-dateutil==2.8.2 diff --git a/scrape.py b/scrape.py index b675a3f..b054228 100644 --- a/scrape.py +++ b/scrape.py @@ -135,9 +135,13 @@ def main(): mkdir_safe(output_dir) - api_data = requests.get(show_config['fireside_url'] + "/json").json() - for api_episode in api_data["items"]: - futures.append(executor.submit(create_episode, api_episode, show_config, output_dir)) + try: + api_data = requests.get(show_config['fireside_url'] + "/json").json() + for api_episode in api_data["items"]: + futures.append(executor.submit(create_episode, api_episode, show_config, output_dir)) + except: + print("ERROR: An error occurred somewhere.") + # Drain to get exceptions. Still have to mash CTRL-C, though. for future in concurrent.futures.as_completed(futures):