Trending: fix mistakes from #3773

This commit is contained in:
Samantaz Fox
2023-05-02 23:18:40 +02:00
parent 97e3938f5f
commit 384a8e200c
2 changed files with 23 additions and 8 deletions

View File

@@ -20,6 +20,20 @@ def fetch_trending(trending_type, region, locale)
items, _ = extract_items(initial_data)
# Return items, but ignore categories (e.g featured content)
return items.reject!(Category), plid
extracted = [] of SearchItem
items.each do |itm|
if itm.is_a?(Category)
# Ignore the smaller categories, as they generally contain a sponsored
# channel, which brings a lot of noise on the trending page.
# See: https://github.com/iv-org/invidious/issues/2989
next if itm.contents.size < 24
extracted.concat extract_category(itm)
else
extracted << itm
end
end
return extracted, plid
end