Skip to content

Commit 2a87f42

Browse files
committed
fix(Search): check if WatchCardHeroVideo is null before casting
Related #243
1 parent f7c1e0f commit 2a87f42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/parser/youtube/Search.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class Search extends Feed {
4040

4141
this.watch_card = {
4242
header: universal_watch_card?.header.item() || null,
43-
call_to_action: universal_watch_card?.call_to_action.item().as(WatchCardHeroVideo) || null,
44-
sections: universal_watch_card?.sections.array().filterType(WatchCardSectionSequence) || []
43+
call_to_action: universal_watch_card?.call_to_action?.item()?.as(WatchCardHeroVideo) || null,
44+
sections: universal_watch_card?.sections?.array()?.filterType(WatchCardSectionSequence) || []
4545
};
4646

4747
this.refinement_cards = {

0 commit comments

Comments
 (0)