From 2c5907f80fd76452afe87d1722fe35a4f45a22e0 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Mon, 27 Mar 2023 20:00:57 +0200 Subject: [PATCH] fix(Search): Return search results even if there are ads (#373) --- 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;