From c506f65c7170d0f16e297273963c06342a559121 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 24 Sep 2020 01:06:47 +1200 Subject: [PATCH] Use empty string instead of null if no description --- extractors/channel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extractors/channel.py b/extractors/channel.py index ef6b191..066d84b 100644 --- a/extractors/channel.py +++ b/extractors/channel.py @@ -130,7 +130,7 @@ def extract_channel_latest(ucid): for entry in feed.findall("{http://www.w3.org/2005/Atom}entry"): id = entry.find("{http://www.youtube.com/xml/schemas/2015}videoId").text media_group = entry.find("{http://search.yahoo.com/mrss/}group") - description = media_group.find("{http://search.yahoo.com/mrss/}description").text + description = media_group.find("{http://search.yahoo.com/mrss/}description").text or "" media_community = media_group.find("{http://search.yahoo.com/mrss/}community") published_entry = entry.find("{http://www.w3.org/2005/Atom}published") if published_entry is not None: # sometimes youtube does not provide published dates, no idea why. @@ -144,7 +144,7 @@ def extract_channel_latest(ucid): "authorUrl": author_url, "videoThumbnails": generate_video_thumbnails(id), "description": description, - "descriptionHtml": description and add_html_links(escape_html_textcontent(description)), + "descriptionHtml": add_html_links(escape_html_textcontent(description)), "viewCount": int(media_community.find("{http://search.yahoo.com/mrss/}statistics").attrib["views"]), "published": published, "publishedText": time_to_past_text(published),