From 66842a79f9c3937f2015606d92d3c37bbdd9a661 Mon Sep 17 00:00:00 2001 From: boyska Date: Sun, 10 Oct 2021 00:01:36 +0200 Subject: [PATCH] handle items without audios thanks for fuzzing me, radioblackout.org --- feed | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/feed b/feed index ed47398..00ac28c 100755 --- a/feed +++ b/feed @@ -297,10 +297,14 @@ def get_urls_generic(tree, url_selector="description[text()]", metadata_in_body= audio.date = get_item_date(it) yield audio else: - url = it.xpath(url_selector)[0] - audio = Audio(url) - audio.date = get_item_date(it) - yield audio + try: + url = it.xpath(url_selector)[0] + except IndexError: + logging.warn("no audio found in %s", title) + else: + audio = Audio(url) + audio.date = get_item_date(it) + yield audio def get_urls_from_podcast(tree):