feat: bring back Video#is_live and add ExpandableMetadata (#256)

* bring back `Video#is_live`

* add ExpandableMetadata
This commit is contained in:
LuanRT
2022-12-15 19:01:42 -03:00
committed by GitHub
parent 883a023624
commit e37f42f41b
8 changed files with 127 additions and 20 deletions

View File

@@ -40,7 +40,7 @@ export default class Search extends Feed {
if (typeof card === 'string') {
if (!this.refinement_cards) throw new InnertubeError('No refinement cards found.');
target_card = this.refinement_cards?.cards.get({ query: card });
target_card = this.refinement_cards?.cards.get({ query: card })?.as(SearchRefinementCard);
if (!target_card)
throw new InnertubeError(`Refinement card "${card}" not found`, { available_cards: this.refinement_card_queries });
} else if (card.type === 'SearchRefinementCard') {
@@ -58,7 +58,7 @@ export default class Search extends Feed {
* Returns a list of refinement card queries.
*/
get refinement_card_queries() {
return this.refinement_cards?.cards.map((card) => card.query);
return this.refinement_cards?.cards.as(SearchRefinementCard).map((card) => card.query);
}
/**