From 1c37dfc72288c0d573d13d52da8b3f0f6d279080 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Tue, 16 May 2023 09:59:59 -0700 Subject: [PATCH] Fix case where pledge price doesnt exist on the page --- app/star_citizen.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/star_citizen.py b/app/star_citizen.py index 1c2b4d74..2d7d4ab6 100644 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -78,11 +78,14 @@ async def get_ship(ship_name): # ingame_price = "No in-game price available" embed.add_field(name="**Ingame Price**", value=ingame_price, inline=True) - pledge_price = ( - soup.find("div", {"class": "data-pledgecost infobox-data infobox-col4"}) - .find("div", {"class": "infobox-data__value"}) - .text - ) + try: + pledge_price = ( + soup.find("div", {"class": "data-pledgecost infobox-data infobox-col4"}) + .find("div", {"class": "infobox-data__value"}) + .text + ) + except Exception: + pledge_price = "N/A" try: links = soup.find_all("a", {"class": "external text"})