From 6e904d35052490ab51fab6b692d5310bfde5a727 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Sun, 24 Dec 2023 14:54:35 -0800 Subject: [PATCH] Account for no ship pricing on finder.cstone's site --- app/star_citizen.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/star_citizen.py b/app/star_citizen.py index b4c10d12..71a3f74a 100755 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -206,14 +206,18 @@ async def get_ship(ship_name): price_table = price_soup.find("div", class_="pricetab").find_next("table") second_row = price_table.find_all("tr")[1] - ingame_price = ( - second_row.find_all("td")[1].get_text(strip=True).replace(" ", ",") - ) - price = "[%s](https://finder.cstone.space/ShipShops1/%s)" % ( - ingame_price, - item_uuid, - ) + if "Not sold directly or at all" in second_row.text: + price = "N/A" + else: + ingame_price = ( + second_row.find_all("td")[1].get_text(strip=True).replace(" ", ",") + ) + + price = "[%s](https://finder.cstone.space/ShipShops1/%s)" % ( + ingame_price, + item_uuid, + ) if "Not available" in ingame_price: price = "N/A"