summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2024-04-26 23:52:44 +0200
committerSamantaz Fox <coding@samantaz.fr>2024-04-26 23:52:44 +0200
commit6f889dc695c2d4acd38352c28ebb45038c32ff55 (patch)
tree065ee7913d7620be1026994f4301bcc08de4e11a
parent8eaaeb1c74c74f32d872ec73b35ee21bb14f7c3b (diff)
parent24de19d06f35cd21a92c7f18869c376ddc170acc (diff)
downloadinvidious-6f889dc695c2d4acd38352c28ebb45038c32ff55.tar.gz
invidious-6f889dc695c2d4acd38352c28ebb45038c32ff55.tar.bz2
invidious-6f889dc695c2d4acd38352c28ebb45038c32ff55.zip
Trending: Un-nest category if this is the only one (#4600)
Trending music was returning less than 24 videos which was getting filtered out. Since multiple categories only appears on the default trending page, we don't need to do that filtering for Music, Gaming or movies. Closes issue 4596
-rw-r--r--src/invidious/trending.cr4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/invidious/trending.cr b/src/invidious/trending.cr
index 2d9f8a83..107d148d 100644
--- a/src/invidious/trending.cr
+++ b/src/invidious/trending.cr
@@ -22,12 +22,14 @@ def fetch_trending(trending_type, region, locale)
extracted = [] of SearchItem
+ deduplicate = items.size > 1
+
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
+ next if (itm.contents.size < 24 && deduplicate)
extracted.concat extract_category(itm)
else