summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsyeopite <syeopite@syeopite.dev>2025-03-19 23:50:41 -0700
committersyeopite <syeopite@syeopite.dev>2025-03-19 23:50:41 -0700
commit7b2758545429e5ad09f0182bf71b351a52815a1d (patch)
tree3cdc2a3a1fc837b151823838c19b9d7c8ed4d6f2
parentf7810ba007d088175c693648d4e040a9fe1101a4 (diff)
downloadinvidious-7b2758545429e5ad09f0182bf71b351a52815a1d.tar.gz
invidious-7b2758545429e5ad09f0182bf71b351a52815a1d.tar.bz2
invidious-7b2758545429e5ad09f0182bf71b351a52815a1d.zip
Support ProblematicTimelineItem in trending feed
-rw-r--r--src/invidious/helpers/serialized_yt_data.cr5
-rw-r--r--src/invidious/trending.cr4
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