Skip to content

Commit

Permalink
perf(Search): Speed up results parsing (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored May 20, 2023
1 parent 5de7b24 commit 1e07a18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser/youtube/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Search extends Feed<ISearchResponse> {
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;
Expand Down

0 comments on commit 1e07a18

Please sign in to comment.