From 2a87f42b32c5ae3be76fd85960a3da464085c647 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Fri, 25 Nov 2022 01:25:02 -0300 Subject: [PATCH] fix(Search): check if WatchCardHeroVideo is null before casting Related #243 --- src/parser/youtube/Search.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser/youtube/Search.ts b/src/parser/youtube/Search.ts index 1f91908e..48e47b72 100644 --- a/src/parser/youtube/Search.ts +++ b/src/parser/youtube/Search.ts @@ -40,8 +40,8 @@ class Search extends Feed { this.watch_card = { header: universal_watch_card?.header.item() || null, - call_to_action: universal_watch_card?.call_to_action.item().as(WatchCardHeroVideo) || null, - sections: universal_watch_card?.sections.array().filterType(WatchCardSectionSequence) || [] + call_to_action: universal_watch_card?.call_to_action?.item()?.as(WatchCardHeroVideo) || null, + sections: universal_watch_card?.sections?.array()?.filterType(WatchCardSectionSequence) || [] }; this.refinement_cards = {