Skip to content

Commit

Permalink
Merge pull request #497 from ZeusWPI/urgentfm
Browse files Browse the repository at this point in the history
Ignore no programme information
  • Loading branch information
niknetniko authored Sep 5, 2024
2 parents 211dc12 + 49649d1 commit 34afee0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/scraper/urgentfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def get_programme():


def get_programme_description(link):
if link is None:
return None, None
response = retry_session.get(link)
soup = BeautifulSoup(response.text, 'html.parser')
image_element = soup.select_one("body > div.content > div > div > div.col-3.col-md-auto > img")
Expand All @@ -45,7 +47,12 @@ def run(output):
os.makedirs(output_path, exist_ok=True) # Like mkdir -p
output_file = os.path.join(output_path, 'status.json') # Output file

programme, programme_link = get_programme()
try:
programme, programme_link = get_programme()
except AttributeError:
# The site is flaky again and I am tired of the mails.
programme, programme_link = "Onbekend", None

try:
programme_image, programme_description = get_programme_description(programme_link)
except IndexError:
Expand Down

0 comments on commit 34afee0

Please sign in to comment.