Files
YouTube.js/lib/parser/map.ts
Daniel Wykerd fb68e6bcfe feat!: better cross runtime support (#97)
* refactor: remove dependancies

removes node-forge and uuid in favor of Web APIs

* refactor!: commonjs to es6

To aid with #93 I will make all my changes in TypeScript instead.
This is the first step into making that happen.

Used: https://github.com/wessberg/cjstoesm

* refactor!: NToken and Signature TS files

Bring this PR up to speed with #93

* feat: cross platform cache (WIP)

this is untested!
should remove idb as dependecy.

* feat: EventEmitter polyfill

* refactor: remove events

* feat: HTTPClient based on Fetch API (WIP)

* refactor!: parsers refactor (WIP)

Initial TS support for parsers as per #93

This adds several type safety checks to the parser which'll help to
ensure valid data is returned by the parser.

* refactor!: parsers refactor (WIP)

Bring more in line with the existing implementations & make less verbose

* refactor!: parser refactor

I was overcomplicating things, this is much simpler and compatible with
the existing JS API

* fix: some missed parsers while refactoring

* fix: better type inferance for parseResponse

* feat(TS): typesafe YTNode casts

* feat: more type safety in YTNode and Parser

* refactor: VideoInfo download with fetch & TS (WIP)

Again, this also does some work for #93

* fix: LiveChat in VideoInfo

* refactor!: more typesafety in parser

* refactor!: VideoInfo almost completed

* refactor!: player and session refactors

- Remove the Player class' dependance on Session.
- Add additional context to the Session.

* refactor!: move auth logic to Session (WIP)

* refactor: TS port for Actions and Innertube

My fingers hurt from typing out all those types :-P

* refactor: NavigationEndpoint TS

this is still a WIP and should be improved.
NavigationEndpoint should probably be refactored further.

* refactor!: VideoInfo compiles without errors

* chore: delete old player

* fix: import errors

It compiles and runs!!

* fix: Utils import fixes

* fix: several runtime errors

* fix: video streaming

* chore: remove console.log debugging

Whoops, forgot to remove these before I pushed the previous commit

* chore: remove old unused dependencies

* fix: typescript errors

Now emitting declarations and source maps

* refactor: TS feed

* chore: delete old Feed

* refactor: move streamToIterable into Utils

* refactor: AccountManager TS

* refactor: FilterableFeed to TS

* refactor: InteractionManager to TS

* refactor: PlaylistManager to TS

* refactor: TabbedFeed to TS

* refactor: Music to TS (WIP)

more work to be done, see TODO comments

* fix: getting the tests to pass (6/12)

YouTube.js Tests
    Search
      ✓ Should search on YouTube (1152 ms)
      ✕ Should search on YouTube Music (705 ms)
      ✕ Should retrieve YouTube search suggestions (722 ms)
      ✓ Should retrieve YouTube Music search suggestions (233 ms)
    Comments
      ✓ Should retrieve comments (585 ms)
      ✕ Should retrieve next batch of comments (221 ms)
      ✕ Should retrieve comment replies (1 ms)
    General
      ✕ Should retrieve playlist with YouTube (732 ms)
      ✓ Should retrieve home feed (838 ms)
      ✓ Should retrieve trending content (543 ms)
      ✓ Should retrieve video info (639 ms)
      ✕ Should download video (5 ms)

* fix: tests (7/12)

YouTube.js Tests
    Search
      ✓ Should search on YouTube (1984 ms)
      ✕ Should search on YouTube Music (1139 ms)
      ✕ Should retrieve YouTube search suggestions (1433 ms)
      ✓ Should retrieve YouTube Music search suggestions (529 ms)
    Comments
      ✓ Should retrieve comments (324 ms)
      ✓ Should retrieve next batch of comments (395 ms)
      ✕ Should retrieve comment replies
    General
      ✕ Should retrieve playlist with YouTube (653 ms)
      ✓ Should retrieve home feed (1085 ms)
      ✓ Should retrieve trending content (513 ms)
      ✓ Should retrieve video info (921 ms)
      ✕ Should download video (3 ms)

* fix: download tests (8/12)

YouTube.js Tests
    Search
      ✓ Should search on YouTube (1293 ms)
      ✕ Should search on YouTube Music (927 ms)
      ✕ Should retrieve YouTube search suggestions (1250 ms)
      ✓ Should retrieve YouTube Music search suggestions (258 ms)
    Comments
      ✓ Should retrieve comments (803 ms)
      ✓ Should retrieve next batch of comments (511 ms)
      ✕ Should retrieve comment replies
    General
      ✕ Should retrieve playlist with YouTube (528 ms)
      ✓ Should retrieve home feed (1047 ms)
      ✓ Should retrieve trending content (548 ms)
      ✓ Should retrieve video info (825 ms)
      ✓ Should download video (1779 ms)

* fix: tests (9/12)

YouTube.js Tests
    Search
      ✓ Should search on YouTube (1276 ms)
      ✕ Should search on YouTube Music (955 ms)
      ✓ Should retrieve YouTube search suggestions (661 ms)
      ✓ Should retrieve YouTube Music search suggestions (491 ms)
    Comments
      ✓ Should retrieve comments (624 ms)
      ✓ Should retrieve next batch of comments (353 ms)
      ✕ Should retrieve comment replies
    General
      ✕ Should retrieve playlist with YouTube (672 ms)
      ✓ Should retrieve home feed (1277 ms)
      ✓ Should retrieve trending content (999 ms)
      ✓ Should retrieve video info (1106 ms)
      ✓ Should download video (2514 ms)

* feat: key based type validation for parsers

* fix: comments tests pass (10/12)

YouTube.js Tests
    Search
      ✓ Should search on YouTube (938 ms)
      ✕ Should search on YouTube Music (850 ms)
      ✓ Should retrieve YouTube search suggestions (528 ms)
      ✓ Should retrieve YouTube Music search suggestions (224 ms)
    Comments
      ✓ Should retrieve comments (518 ms)
      ✓ Should retrieve next batch of comments (337 ms)
      ✓ Should retrieve comment replies (358 ms)
    General
      ✕ Should retrieve playlist with YouTube (466 ms)
      ✓ Should retrieve home feed (1051 ms)
      ✓ Should retrieve trending content (623 ms)
      ✓ Should retrieve video info (863 ms)
      ✓ Should download video (2656 ms)

* refactor: type safety checks removing @ts-ignore

* fix: playlist tests pass (11/12)

YouTube.js Tests
    Search
      ✓ Should search on YouTube (991 ms)
      ✕ Should search on YouTube Music (924 ms)
      ✓ Should retrieve YouTube search suggestions (606 ms)
      ✓ Should retrieve YouTube Music search suggestions (225 ms)
    Comments
      ✓ Should retrieve comments (393 ms)
      ✓ Should retrieve next batch of comments (284 ms)
      ✓ Should retrieve comment replies (252 ms)
    General
      ✓ Should retrieve playlist with YouTube (578 ms)
      ✓ Should retrieve home feed (1148 ms)
      ✓ Should retrieve trending content (541 ms)
      ✓ Should retrieve video info (799 ms)
      ✓ Should download video (1419 ms)

* fix: all tests pass for node 🎉

YouTube.js Tests
    Search
      ✓ Should search on YouTube (1053 ms)
      ✓ Should search on YouTube Music (761 ms)
      ✓ Should retrieve YouTube search suggestions (453 ms)
      ✓ Should retrieve YouTube Music search suggestions (221 ms)
    Comments
      ✓ Should retrieve comments (627 ms)
      ✓ Should retrieve next batch of comments (412 ms)
      ✓ Should retrieve comment replies (268 ms)
    General
      ✓ Should retrieve playlist with YouTube (565 ms)
      ✓ Should retrieve home feed (775 ms)
      ✓ Should retrieve trending content (498 ms)
      ✓ Should retrieve video info (875 ms)
      ✓ Should download video (1364 ms)

* build: working Deno bundle

Still need to test whether this bundle works in the browser

* docs: update deno example to download video

* refactor: MusicResponsiveListItem to TS

* docs: TSDoc for Parser helpers

* docs: Parser documentation for TS

* docs: add note about parseItem and parseArray

* test: remove browser tests since they're identical

* feat: browser support and proxy example

* fix: PlaylistManager TS after merge

* feat: in-browser video streaming

* refactor: cleanup the Dash example

* feat: allow custom fetch implementations

* feat: fetch debugger

* fix: OAuth login

* refactor: remove file extensions from imports

* refactor: build scripts

* fix: CustomEvent on node

* fix: LiveChat

* fix: linting

* fix: liniting in build-parser-json

* chore: update test workflow

* fix: NToken errors after lint fixes

* fix: codacy complaints

* docs: update to reflect changes

Definitly needs more work but its a start

* refactor: cleanup imports/exports

* fix: browser example

- Remove user-agent before making request.
- Fix cache on browsers

* fix: cache on node

* fix: stupid mistake

* refactor: Session#signIn to wait untill success

This also splits the 'auth' event up into 3 distinct events:
- 'auth' -> fired on success
- 'auth-pending' -> fired when pending authentication
- 'auth-error' -> fired when an error occurred

* refactor: freeze Constants

* refactor: cleanup HTTPClient Request

* refactor: debugFetch readability

* chore: lint

* refactor: replace jsdoc with tsdoc eslint plugin

remove @param annotations without descriptions

* fix: bunch of liniting warnings

* refactor: better inference on YTNode#is

As suggested by @MasterOfBob777

* fix: linting warnings

* revert: undici import

* refactor: rename `list_type` to `item_type`
2022-07-20 14:06:12 -03:00

477 lines
23 KiB
TypeScript

// This file was auto generated, do not edit.
// See ./scripts/build-parser-json.js
import { YTNodeConstructor } from './helpers';
import { default as AppendContinuationItemsAction } from './classes/actions/AppendContinuationItemsAction';
import { default as OpenPopupAction } from './classes/actions/OpenPopupAction';
import { default as AnalyticsMainAppKeyMetrics } from './classes/AnalyticsMainAppKeyMetrics';
import { default as AnalyticsVideo } from './classes/AnalyticsVideo';
import { default as AnalyticsVodCarouselCard } from './classes/AnalyticsVodCarouselCard';
import { default as BackstageImage } from './classes/BackstageImage';
import { default as BackstagePost } from './classes/BackstagePost';
import { default as BackstagePostThread } from './classes/BackstagePostThread';
import { default as BrowseFeedActions } from './classes/BrowseFeedActions';
import { default as Button } from './classes/Button';
import { default as C4TabbedHeader } from './classes/C4TabbedHeader';
import { default as CallToActionButton } from './classes/CallToActionButton';
import { default as Card } from './classes/Card';
import { default as CardCollection } from './classes/CardCollection';
import { default as Channel } from './classes/Channel';
import { default as ChannelAboutFullMetadata } from './classes/ChannelAboutFullMetadata';
import { default as ChannelFeaturedContent } from './classes/ChannelFeaturedContent';
import { default as ChannelHeaderLinks } from './classes/ChannelHeaderLinks';
import { default as ChannelMetadata } from './classes/ChannelMetadata';
import { default as ChannelMobileHeader } from './classes/ChannelMobileHeader';
import { default as ChannelThumbnailWithLink } from './classes/ChannelThumbnailWithLink';
import { default as ChannelVideoPlayer } from './classes/ChannelVideoPlayer';
import { default as ChildVideo } from './classes/ChildVideo';
import { default as ChipCloud } from './classes/ChipCloud';
import { default as ChipCloudChip } from './classes/ChipCloudChip';
import { default as CollageHeroImage } from './classes/CollageHeroImage';
import { default as AuthorCommentBadge } from './classes/comments/AuthorCommentBadge';
import { default as Comment } from './classes/comments/Comment';
import { default as CommentActionButtons } from './classes/comments/CommentActionButtons';
import { default as CommentReplies } from './classes/comments/CommentReplies';
import { default as CommentReplyDialog } from './classes/comments/CommentReplyDialog';
import { default as CommentsEntryPointHeader } from './classes/comments/CommentsEntryPointHeader';
import { default as CommentsHeader } from './classes/comments/CommentsHeader';
import { default as CommentSimplebox } from './classes/comments/CommentSimplebox';
import { default as CommentThread } from './classes/comments/CommentThread';
import { default as CompactLink } from './classes/CompactLink';
import { default as CompactMix } from './classes/CompactMix';
import { default as CompactPlaylist } from './classes/CompactPlaylist';
import { default as CompactVideo } from './classes/CompactVideo';
import { default as ContinuationItem } from './classes/ContinuationItem';
import { default as CtaGoToCreatorStudio } from './classes/CtaGoToCreatorStudio';
import { default as DataModelSection } from './classes/DataModelSection';
import { default as DidYouMean } from './classes/DidYouMean';
import { default as DownloadButton } from './classes/DownloadButton';
import { default as Element } from './classes/Element';
import { default as EmergencyOnebox } from './classes/EmergencyOnebox';
import { default as EmojiRun } from './classes/EmojiRun';
import { default as Endscreen } from './classes/Endscreen';
import { default as EndscreenElement } from './classes/EndscreenElement';
import { default as EndScreenPlaylist } from './classes/EndScreenPlaylist';
import { default as EndScreenVideo } from './classes/EndScreenVideo';
import { default as ExpandableTab } from './classes/ExpandableTab';
import { default as ExpandedShelfContents } from './classes/ExpandedShelfContents';
import { default as FeedFilterChipBar } from './classes/FeedFilterChipBar';
import { default as FeedTabbedHeader } from './classes/FeedTabbedHeader';
import { default as Grid } from './classes/Grid';
import { default as GridChannel } from './classes/GridChannel';
import { default as GridPlaylist } from './classes/GridPlaylist';
import { default as GridVideo } from './classes/GridVideo';
import { default as HistorySuggestion } from './classes/HistorySuggestion';
import { default as HorizontalCardList } from './classes/HorizontalCardList';
import { default as HorizontalList } from './classes/HorizontalList';
import { default as ItemSection } from './classes/ItemSection';
import { default as ItemSectionHeader } from './classes/ItemSectionHeader';
import { default as LikeButton } from './classes/LikeButton';
import { default as LiveChat } from './classes/LiveChat';
import { default as AddBannerToLiveChatCommand } from './classes/livechat/AddBannerToLiveChatCommand';
import { default as AddChatItemAction } from './classes/livechat/AddChatItemAction';
import { default as AddLiveChatTickerItemAction } from './classes/livechat/AddLiveChatTickerItemAction';
import { default as LiveChatBanner } from './classes/livechat/items/LiveChatBanner';
import { default as LiveChatBannerHeader } from './classes/livechat/items/LiveChatBannerHeader';
import { default as LiveChatBannerPoll } from './classes/livechat/items/LiveChatBannerPoll';
import { default as LiveChatMembershipItem } from './classes/livechat/items/LiveChatMembershipItem';
import { default as LiveChatPaidMessage } from './classes/livechat/items/LiveChatPaidMessage';
import { default as LiveChatPaidSticker } from './classes/livechat/items/LiveChatPaidSticker';
import { default as LiveChatPlaceholderItem } from './classes/livechat/items/LiveChatPlaceholderItem';
import { default as LiveChatTextMessage } from './classes/livechat/items/LiveChatTextMessage';
import { default as LiveChatTickerPaidMessageItem } from './classes/livechat/items/LiveChatTickerPaidMessageItem';
import { default as LiveChatTickerSponsorItem } from './classes/livechat/items/LiveChatTickerSponsorItem';
import { default as LiveChatViewerEngagementMessage } from './classes/livechat/items/LiveChatViewerEngagementMessage';
import { default as PollHeader } from './classes/livechat/items/PollHeader';
import { default as LiveChatActionPanel } from './classes/livechat/LiveChatActionPanel';
import { default as MarkChatItemAsDeletedAction } from './classes/livechat/MarkChatItemAsDeletedAction';
import { default as MarkChatItemsByAuthorAsDeletedAction } from './classes/livechat/MarkChatItemsByAuthorAsDeletedAction';
import { default as RemoveBannerForLiveChatCommand } from './classes/livechat/RemoveBannerForLiveChatCommand';
import { default as ReplaceChatItemAction } from './classes/livechat/ReplaceChatItemAction';
import { default as ReplayChatItemAction } from './classes/livechat/ReplayChatItemAction';
import { default as ShowLiveChatActionPanelAction } from './classes/livechat/ShowLiveChatActionPanelAction';
import { default as ShowLiveChatTooltipCommand } from './classes/livechat/ShowLiveChatTooltipCommand';
import { default as UpdateDateTextAction } from './classes/livechat/UpdateDateTextAction';
import { default as UpdateDescriptionAction } from './classes/livechat/UpdateDescriptionAction';
import { default as UpdateLiveChatPollAction } from './classes/livechat/UpdateLiveChatPollAction';
import { default as UpdateTitleAction } from './classes/livechat/UpdateTitleAction';
import { default as UpdateToggleButtonTextAction } from './classes/livechat/UpdateToggleButtonTextAction';
import { default as UpdateViewershipAction } from './classes/livechat/UpdateViewershipAction';
import { default as LiveChatAuthorBadge } from './classes/LiveChatAuthorBadge';
import { default as LiveChatHeader } from './classes/LiveChatHeader';
import { default as LiveChatItemList } from './classes/LiveChatItemList';
import { default as LiveChatMessageInput } from './classes/LiveChatMessageInput';
import { default as LiveChatParticipant } from './classes/LiveChatParticipant';
import { default as LiveChatParticipantsList } from './classes/LiveChatParticipantsList';
import { default as Menu } from './classes/menus/Menu';
import { default as MenuNavigationItem } from './classes/menus/MenuNavigationItem';
import { default as MenuServiceItem } from './classes/menus/MenuServiceItem';
import { default as MenuServiceItemDownload } from './classes/menus/MenuServiceItemDownload';
import { default as MultiPageMenu } from './classes/menus/MultiPageMenu';
import { default as MultiPageMenuNotificationSection } from './classes/menus/MultiPageMenuNotificationSection';
import { default as SimpleMenuHeader } from './classes/menus/SimpleMenuHeader';
import { default as MerchandiseItem } from './classes/MerchandiseItem';
import { default as MerchandiseShelf } from './classes/MerchandiseShelf';
import { default as Message } from './classes/Message';
import { default as MetadataBadge } from './classes/MetadataBadge';
import { default as MetadataRow } from './classes/MetadataRow';
import { default as MetadataRowContainer } from './classes/MetadataRowContainer';
import { default as MetadataRowHeader } from './classes/MetadataRowHeader';
import { default as MicroformatData } from './classes/MicroformatData';
import { default as Mix } from './classes/Mix';
import { default as Movie } from './classes/Movie';
import { default as MovingThumbnail } from './classes/MovingThumbnail';
import { default as MusicCarouselShelf } from './classes/MusicCarouselShelf';
import { default as MusicCarouselShelfBasicHeader } from './classes/MusicCarouselShelfBasicHeader';
import { default as MusicDescriptionShelf } from './classes/MusicDescriptionShelf';
import { default as MusicDetailHeader } from './classes/MusicDetailHeader';
import { default as MusicHeader } from './classes/MusicHeader';
import { default as MusicImmersiveHeader } from './classes/MusicImmersiveHeader';
import { default as MusicInlineBadge } from './classes/MusicInlineBadge';
import { default as MusicItemThumbnailOverlay } from './classes/MusicItemThumbnailOverlay';
import { default as MusicNavigationButton } from './classes/MusicNavigationButton';
import { default as MusicPlayButton } from './classes/MusicPlayButton';
import { default as MusicPlaylistShelf } from './classes/MusicPlaylistShelf';
import { default as MusicQueue } from './classes/MusicQueue';
import { default as MusicResponsiveListItem } from './classes/MusicResponsiveListItem';
import { default as MusicResponsiveListItemFixedColumn } from './classes/MusicResponsiveListItemFixedColumn';
import { default as MusicResponsiveListItemFlexColumn } from './classes/MusicResponsiveListItemFlexColumn';
import { default as MusicShelf } from './classes/MusicShelf';
import { default as MusicThumbnail } from './classes/MusicThumbnail';
import { default as MusicTwoRowItem } from './classes/MusicTwoRowItem';
import { default as NavigationEndpoint } from './classes/NavigationEndpoint';
import { default as Notification } from './classes/Notification';
import { default as PlayerAnnotationsExpanded } from './classes/PlayerAnnotationsExpanded';
import { default as PlayerCaptionsTracklist } from './classes/PlayerCaptionsTracklist';
import { default as PlayerErrorMessage } from './classes/PlayerErrorMessage';
import { default as PlayerLiveStoryboardSpec } from './classes/PlayerLiveStoryboardSpec';
import { default as PlayerMicroformat } from './classes/PlayerMicroformat';
import { default as PlayerOverlay } from './classes/PlayerOverlay';
import { default as PlayerOverlayAutoplay } from './classes/PlayerOverlayAutoplay';
import { default as PlayerStoryboardSpec } from './classes/PlayerStoryboardSpec';
import { default as Playlist } from './classes/Playlist';
import { default as PlaylistHeader } from './classes/PlaylistHeader';
import { default as PlaylistInfoCardContent } from './classes/PlaylistInfoCardContent';
import { default as PlaylistMetadata } from './classes/PlaylistMetadata';
import { default as PlaylistPanel } from './classes/PlaylistPanel';
import { default as PlaylistPanelVideo } from './classes/PlaylistPanelVideo';
import { default as PlaylistSidebar } from './classes/PlaylistSidebar';
import { default as PlaylistSidebarPrimaryInfo } from './classes/PlaylistSidebarPrimaryInfo';
import { default as PlaylistSidebarSecondaryInfo } from './classes/PlaylistSidebarSecondaryInfo';
import { default as PlaylistVideo } from './classes/PlaylistVideo';
import { default as PlaylistVideoList } from './classes/PlaylistVideoList';
import { default as PlaylistVideoThumbnail } from './classes/PlaylistVideoThumbnail';
import { default as Poll } from './classes/Poll';
import { default as Post } from './classes/Post';
import { default as ProfileColumn } from './classes/ProfileColumn';
import { default as ProfileColumnStats } from './classes/ProfileColumnStats';
import { default as ProfileColumnStatsEntry } from './classes/ProfileColumnStatsEntry';
import { default as ProfileColumnUserInfo } from './classes/ProfileColumnUserInfo';
import { default as ReelItem } from './classes/ReelItem';
import { default as ReelShelf } from './classes/ReelShelf';
import { default as RelatedChipCloud } from './classes/RelatedChipCloud';
import { default as RichGrid } from './classes/RichGrid';
import { default as RichItem } from './classes/RichItem';
import { default as RichListHeader } from './classes/RichListHeader';
import { default as RichSection } from './classes/RichSection';
import { default as RichShelf } from './classes/RichShelf';
import { default as SearchBox } from './classes/SearchBox';
import { default as SearchRefinementCard } from './classes/SearchRefinementCard';
import { default as SearchSuggestion } from './classes/SearchSuggestion';
import { default as SearchSuggestionsSection } from './classes/SearchSuggestionsSection';
import { default as SecondarySearchContainer } from './classes/SecondarySearchContainer';
import { default as SectionList } from './classes/SectionList';
import { default as Shelf } from './classes/Shelf';
import { default as ShowingResultsFor } from './classes/ShowingResultsFor';
import { default as SimpleCardTeaser } from './classes/SimpleCardTeaser';
import { default as SingleActionEmergencySupport } from './classes/SingleActionEmergencySupport';
import { default as SingleColumnBrowseResults } from './classes/SingleColumnBrowseResults';
import { default as SingleColumnMusicWatchNextResults } from './classes/SingleColumnMusicWatchNextResults';
import { default as SingleHeroImage } from './classes/SingleHeroImage';
import { default as SortFilterSubMenu } from './classes/SortFilterSubMenu';
import { default as SubFeedOption } from './classes/SubFeedOption';
import { default as SubFeedSelector } from './classes/SubFeedSelector';
import { default as SubscribeButton } from './classes/SubscribeButton';
import { default as SubscriptionNotificationToggleButton } from './classes/SubscriptionNotificationToggleButton';
import { default as Tab } from './classes/Tab';
import { default as Tabbed } from './classes/Tabbed';
import { default as TabbedSearchResults } from './classes/TabbedSearchResults';
import { default as TextHeader } from './classes/TextHeader';
import { default as ThumbnailOverlayBottomPanel } from './classes/ThumbnailOverlayBottomPanel';
import { default as ThumbnailOverlayEndorsement } from './classes/ThumbnailOverlayEndorsement';
import { default as ThumbnailOverlayHoverText } from './classes/ThumbnailOverlayHoverText';
import { default as ThumbnailOverlayInlineUnplayable } from './classes/ThumbnailOverlayInlineUnplayable';
import { default as ThumbnailOverlayLoadingPreview } from './classes/ThumbnailOverlayLoadingPreview';
import { default as ThumbnailOverlayNowPlaying } from './classes/ThumbnailOverlayNowPlaying';
import { default as ThumbnailOverlayPinking } from './classes/ThumbnailOverlayPinking';
import { default as ThumbnailOverlayPlaybackStatus } from './classes/ThumbnailOverlayPlaybackStatus';
import { default as ThumbnailOverlayResumePlayback } from './classes/ThumbnailOverlayResumePlayback';
import { default as ThumbnailOverlaySidePanel } from './classes/ThumbnailOverlaySidePanel';
import { default as ThumbnailOverlayTimeStatus } from './classes/ThumbnailOverlayTimeStatus';
import { default as ThumbnailOverlayToggleButton } from './classes/ThumbnailOverlayToggleButton';
import { default as ToggleButton } from './classes/ToggleButton';
import { default as ToggleMenuServiceItem } from './classes/ToggleMenuServiceItem';
import { default as Tooltip } from './classes/Tooltip';
import { default as TwoColumnBrowseResults } from './classes/TwoColumnBrowseResults';
import { default as TwoColumnSearchResults } from './classes/TwoColumnSearchResults';
import { default as TwoColumnWatchNextResults } from './classes/TwoColumnWatchNextResults';
import { default as UniversalWatchCard } from './classes/UniversalWatchCard';
import { default as VerticalList } from './classes/VerticalList';
import { default as VerticalWatchCardList } from './classes/VerticalWatchCardList';
import { default as Video } from './classes/Video';
import { default as VideoInfoCardContent } from './classes/VideoInfoCardContent';
import { default as VideoOwner } from './classes/VideoOwner';
import { default as VideoPrimaryInfo } from './classes/VideoPrimaryInfo';
import { default as VideoSecondaryInfo } from './classes/VideoSecondaryInfo';
import { default as WatchCardCompactVideo } from './classes/WatchCardCompactVideo';
import { default as WatchCardHeroVideo } from './classes/WatchCardHeroVideo';
import { default as WatchCardRichHeader } from './classes/WatchCardRichHeader';
import { default as WatchCardSectionSequence } from './classes/WatchCardSectionSequence';
import { default as WatchNextEndScreen } from './classes/WatchNextEndScreen';
import { default as WatchNextTabbedResults } from './classes/WatchNextTabbedResults';
const map: Record<string, YTNodeConstructor> = {
AppendContinuationItemsAction,
OpenPopupAction,
AnalyticsMainAppKeyMetrics,
AnalyticsVideo,
AnalyticsVodCarouselCard,
BackstageImage,
BackstagePost,
BackstagePostThread,
BrowseFeedActions,
Button,
C4TabbedHeader,
CallToActionButton,
Card,
CardCollection,
Channel,
ChannelAboutFullMetadata,
ChannelFeaturedContent,
ChannelHeaderLinks,
ChannelMetadata,
ChannelMobileHeader,
ChannelThumbnailWithLink,
ChannelVideoPlayer,
ChildVideo,
ChipCloud,
ChipCloudChip,
CollageHeroImage,
AuthorCommentBadge,
Comment,
CommentActionButtons,
CommentReplies,
CommentReplyDialog,
CommentsEntryPointHeader,
CommentsHeader,
CommentSimplebox,
CommentThread,
CompactLink,
CompactMix,
CompactPlaylist,
CompactVideo,
ContinuationItem,
CtaGoToCreatorStudio,
DataModelSection,
DidYouMean,
DownloadButton,
Element,
EmergencyOnebox,
EmojiRun,
Endscreen,
EndscreenElement,
EndScreenPlaylist,
EndScreenVideo,
ExpandableTab,
ExpandedShelfContents,
FeedFilterChipBar,
FeedTabbedHeader,
Grid,
GridChannel,
GridPlaylist,
GridVideo,
HistorySuggestion,
HorizontalCardList,
HorizontalList,
ItemSection,
ItemSectionHeader,
LikeButton,
LiveChat,
AddBannerToLiveChatCommand,
AddChatItemAction,
AddLiveChatTickerItemAction,
LiveChatBanner,
LiveChatBannerHeader,
LiveChatBannerPoll,
LiveChatMembershipItem,
LiveChatPaidMessage,
LiveChatPaidSticker,
LiveChatPlaceholderItem,
LiveChatTextMessage,
LiveChatTickerPaidMessageItem,
LiveChatTickerSponsorItem,
LiveChatViewerEngagementMessage,
PollHeader,
LiveChatActionPanel,
MarkChatItemAsDeletedAction,
MarkChatItemsByAuthorAsDeletedAction,
RemoveBannerForLiveChatCommand,
ReplaceChatItemAction,
ReplayChatItemAction,
ShowLiveChatActionPanelAction,
ShowLiveChatTooltipCommand,
UpdateDateTextAction,
UpdateDescriptionAction,
UpdateLiveChatPollAction,
UpdateTitleAction,
UpdateToggleButtonTextAction,
UpdateViewershipAction,
LiveChatAuthorBadge,
LiveChatHeader,
LiveChatItemList,
LiveChatMessageInput,
LiveChatParticipant,
LiveChatParticipantsList,
Menu,
MenuNavigationItem,
MenuServiceItem,
MenuServiceItemDownload,
MultiPageMenu,
MultiPageMenuNotificationSection,
SimpleMenuHeader,
MerchandiseItem,
MerchandiseShelf,
Message,
MetadataBadge,
MetadataRow,
MetadataRowContainer,
MetadataRowHeader,
MicroformatData,
Mix,
Movie,
MovingThumbnail,
MusicCarouselShelf,
MusicCarouselShelfBasicHeader,
MusicDescriptionShelf,
MusicDetailHeader,
MusicHeader,
MusicImmersiveHeader,
MusicInlineBadge,
MusicItemThumbnailOverlay,
MusicNavigationButton,
MusicPlayButton,
MusicPlaylistShelf,
MusicQueue,
MusicResponsiveListItem,
MusicResponsiveListItemFixedColumn,
MusicResponsiveListItemFlexColumn,
MusicShelf,
MusicThumbnail,
MusicTwoRowItem,
NavigationEndpoint,
Notification,
PlayerAnnotationsExpanded,
PlayerCaptionsTracklist,
PlayerErrorMessage,
PlayerLiveStoryboardSpec,
PlayerMicroformat,
PlayerOverlay,
PlayerOverlayAutoplay,
PlayerStoryboardSpec,
Playlist,
PlaylistHeader,
PlaylistInfoCardContent,
PlaylistMetadata,
PlaylistPanel,
PlaylistPanelVideo,
PlaylistSidebar,
PlaylistSidebarPrimaryInfo,
PlaylistSidebarSecondaryInfo,
PlaylistVideo,
PlaylistVideoList,
PlaylistVideoThumbnail,
Poll,
Post,
ProfileColumn,
ProfileColumnStats,
ProfileColumnStatsEntry,
ProfileColumnUserInfo,
ReelItem,
ReelShelf,
RelatedChipCloud,
RichGrid,
RichItem,
RichListHeader,
RichSection,
RichShelf,
SearchBox,
SearchRefinementCard,
SearchSuggestion,
SearchSuggestionsSection,
SecondarySearchContainer,
SectionList,
Shelf,
ShowingResultsFor,
SimpleCardTeaser,
SingleActionEmergencySupport,
SingleColumnBrowseResults,
SingleColumnMusicWatchNextResults,
SingleHeroImage,
SortFilterSubMenu,
SubFeedOption,
SubFeedSelector,
SubscribeButton,
SubscriptionNotificationToggleButton,
Tab,
Tabbed,
TabbedSearchResults,
TextHeader,
ThumbnailOverlayBottomPanel,
ThumbnailOverlayEndorsement,
ThumbnailOverlayHoverText,
ThumbnailOverlayInlineUnplayable,
ThumbnailOverlayLoadingPreview,
ThumbnailOverlayNowPlaying,
ThumbnailOverlayPinking,
ThumbnailOverlayPlaybackStatus,
ThumbnailOverlayResumePlayback,
ThumbnailOverlaySidePanel,
ThumbnailOverlayTimeStatus,
ThumbnailOverlayToggleButton,
ToggleButton,
ToggleMenuServiceItem,
Tooltip,
TwoColumnBrowseResults,
TwoColumnSearchResults,
TwoColumnWatchNextResults,
UniversalWatchCard,
VerticalList,
VerticalWatchCardList,
Video,
VideoInfoCardContent,
VideoOwner,
VideoPrimaryInfo,
VideoSecondaryInfo,
WatchCardCompactVideo,
WatchCardHeroVideo,
WatchCardRichHeader,
WatchCardSectionSequence,
WatchNextEndScreen,
WatchNextTabbedResults
};
/**
* @param name - Name of the node to be parsed
*/
export default function GetParserByName(name: string) {
const ParserConstructor = map[name];
if (!ParserConstructor) {
const error = new Error(`Module not found: ${name}`);
(error as any).code = 'MODULE_NOT_FOUND';
throw error;
}
return ParserConstructor;
}