From b1d9d7c8e4d34a1c2817e2f646d26201daa737dd Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sun, 26 Mar 2023 15:38:49 +0200 Subject: [PATCH] fix(Search): Return search results even if there are ads --- src/parser/youtube/Search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/youtube/Search.ts b/src/parser/youtube/Search.ts index a2e65f19b..b1e2f0919 100644 --- a/src/parser/youtube/Search.ts +++ b/src/parser/youtube/Search.ts @@ -30,7 +30,7 @@ class Search extends Feed { if (!contents) throw new InnertubeError('No contents found in search response'); - this.results = contents.firstOfType(ItemSection)?.contents; + this.results = contents.filterType(ItemSection).find((section) => section.contents && section.contents.length > 0)?.contents; this.refinements = this.page.refinements || []; this.estimated_results = this.page.estimated_results;