From 1e07a184ffaff508ad5ba869cb5e7dc9f095f744 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sat, 20 May 2023 22:57:48 +0200 Subject: [PATCH] perf(Search): Speed up results parsing (#408) --- 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 1295b1e5..5999c46c 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.filterType(ItemSection).find((section) => section.contents && section.contents.length > 0)?.contents; + this.results = contents.find((content) => content.is(ItemSection) && content.contents && content.contents.length > 0)?.as(ItemSection).contents; this.refinements = this.page.refinements || []; this.estimated_results = this.page.estimated_results;