From 6411688e65bcd0ef5674472dee13aaccd063d917 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 5 Nov 2023 22:12:21 +0100 Subject: [PATCH] [`youtube`] Don't fail if some items in the response have missing attrs. --- platypush/plugins/youtube/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platypush/plugins/youtube/__init__.py b/platypush/plugins/youtube/__init__.py index 28dbd01a9..aff9f2a08 100644 --- a/platypush/plugins/youtube/__init__.py +++ b/platypush/plugins/youtube/__init__.py @@ -57,10 +57,10 @@ class YoutubePlugin(Plugin): results = [ { "url": "https://www.youtube.com" + item["url"], - "title": item["title"], - "image": item["thumbnail"], - "duration": item["duration"], - "description": item["shortDescription"], + "title": item.get("title", '[No title]'), + "image": item.get("thumbnail"), + "duration": item.get("duration", 0), + "description": item.get("shortDescription"), } for item in rs.json().get("items", []) ]