mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-14 12:07:30 +00:00
Use empty string instead of null if no description
This commit is contained in:
parent
caee795b7e
commit
c506f65c71
@ -130,7 +130,7 @@ def extract_channel_latest(ucid):
|
|||||||
for entry in feed.findall("{http://www.w3.org/2005/Atom}entry"):
|
for entry in feed.findall("{http://www.w3.org/2005/Atom}entry"):
|
||||||
id = entry.find("{http://www.youtube.com/xml/schemas/2015}videoId").text
|
id = entry.find("{http://www.youtube.com/xml/schemas/2015}videoId").text
|
||||||
media_group = entry.find("{http://search.yahoo.com/mrss/}group")
|
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")
|
media_community = media_group.find("{http://search.yahoo.com/mrss/}community")
|
||||||
published_entry = entry.find("{http://www.w3.org/2005/Atom}published")
|
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.
|
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,
|
"authorUrl": author_url,
|
||||||
"videoThumbnails": generate_video_thumbnails(id),
|
"videoThumbnails": generate_video_thumbnails(id),
|
||||||
"description": description,
|
"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"]),
|
"viewCount": int(media_community.find("{http://search.yahoo.com/mrss/}statistics").attrib["views"]),
|
||||||
"published": published,
|
"published": published,
|
||||||
"publishedText": time_to_past_text(published),
|
"publishedText": time_to_past_text(published),
|
||||||
|
Loading…
Reference in New Issue
Block a user