From 7b2758545429e5ad09f0182bf71b351a52815a1d Mon Sep 17 00:00:00 2001 From: syeopite Date: Wed, 19 Mar 2025 23:50:41 -0700 Subject: [PATCH] Support ProblematicTimelineItem in trending feed --- src/invidious/helpers/serialized_yt_data.cr | 5 ++++- src/invidious/trending.cr | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.cr index 56b64dbf..a6501e41 100644 --- a/src/invidious/helpers/serialized_yt_data.cr +++ b/src/invidious/helpers/serialized_yt_data.cr @@ -299,8 +299,11 @@ end # the rest of the (hopefully) successfully parsed item on a page. struct ProblematicTimelineItem property parse_exception : Exception + property id : String - def initialize(@parse_exception); end + def initialize(@parse_exception) + @id = Random.new.hex(8) + end def to_json(locale : String?, json : JSON::Builder) json.object do diff --git a/src/invidious/trending.cr b/src/invidious/trending.cr index 107d148d..d14cde5d 100644 --- a/src/invidious/trending.cr +++ b/src/invidious/trending.cr @@ -31,12 +31,12 @@ def fetch_trending(trending_type, region, locale) # See: https://github.com/iv-org/invidious/issues/2989 next if (itm.contents.size < 24 && deduplicate) - extracted.concat extract_category(itm) + extracted.concat itm.contents.select(SearchItem) else extracted << itm end end # Deduplicate items before returning results - return extracted.select(SearchVideo).uniq!(&.id), plid + return extracted.select(SearchVideo | ProblematicTimelineItem).uniq!(&.id), plid end