add more checks for failures

This commit is contained in:
rra 2022-06-01 05:51:25 +02:00
parent 9c824fcd3f
commit ad591ea9cf
1 changed files with 13 additions and 9 deletions

View File

@ -152,10 +152,13 @@ def parse_enclosures(post_dir, entry):
#TODO handle the fact it could be multiple items
for e in entry.enclosures:
print("found enclosed media", e.type)
if "image/" in e.type:
featured_image = grab_media(post_dir, e.href)
entry["featured_image"] = featured_image
if "type" in e:
print("found enclosed media", e.type)
if "image/" in e.type:
featured_image = grab_media(post_dir, e.href)
entry["featured_image"] = featured_image
else:
print("FIXME:ignoring enclosed", e.type)
return entry
@ -267,11 +270,12 @@ def grab_feed(feed_url):
print(e)
return False
print(data.status, feed_url)
if data.status == 200:
# 304 means the feed has not been modified since we last checked
write_etag(feed_name, data)
return data
if "status" in data:
print(data.status, feed_url)
if data.status == 200:
# 304 means the feed has not been modified since we last checked
write_etag(feed_name, data)
return data
return False
def create_opds_post(post_dir, entry):