1
0
Fork 0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2026-03-07 13:01:37 +00:00

Add publishedText to /channels/latest

This commit is contained in:
Cadence Ember 2020-08-31 02:26:46 +12:00
parent c2a7bb907b
commit 0a6a07838d
No known key found for this signature in database
GPG key ID: 128B99B1B74A6412
2 changed files with 24 additions and 1 deletions

View file

@ -120,6 +120,7 @@ def extract_channel_latest(ucid):
media_group = entry.find("{http://search.yahoo.com/mrss/}group")
description = media_group.find("{http://search.yahoo.com/mrss/}description").text
media_community = media_group.find("{http://search.yahoo.com/mrss/}community")
published = int(dateutil.parser.isoparse(entry.find("{http://www.w3.org/2005/Atom}published").text).timestamp())
results.append({
"type": "video",
"title": entry.find("{http://www.w3.org/2005/Atom}title").text,
@ -131,7 +132,8 @@ def extract_channel_latest(ucid):
"description": description,
"descriptionHtml": add_html_links(escape_html_textcontent(description)),
"viewCount": int(media_community.find("{http://search.yahoo.com/mrss/}statistics").attrib["views"]),
"published": int(dateutil.parser.isoparse(entry.find("{http://www.w3.org/2005/Atom}published").text).timestamp()),
"published": published,
"publishedText": time_to_past_text(published),
"lengthSeconds": None,
"liveNow": None,
"paid": None,