From 049fd16aab03b84d0f3e27f5363cd82e3e3f9ea2 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Thu, 9 Jun 2022 15:19:46 -0300 Subject: [PATCH] docs: update jsdoc comments --- lib/parser/youtube/History.js | 2 +- lib/parser/youtube/Library.js | 2 +- lib/parser/youtube/Search.js | 2 +- lib/parser/youtube/VideoInfo.js | 26 +++++++++++++------------- lib/parser/ytmusic/Search.js | 18 ++++++++++++------ 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/lib/parser/youtube/History.js b/lib/parser/youtube/History.js index f13097cf..9d9bc8e9 100644 --- a/lib/parser/youtube/History.js +++ b/lib/parser/youtube/History.js @@ -8,7 +8,7 @@ class History { /** * @param {object} page - parsed data. - * @param {import('./Actions')} actions + * @param {import('../../core/Actions')} actions * @param {boolean} is_continuation * @constructor */ diff --git a/lib/parser/youtube/Library.js b/lib/parser/youtube/Library.js index 3be34ff5..0bd4e6e6 100644 --- a/lib/parser/youtube/Library.js +++ b/lib/parser/youtube/Library.js @@ -10,7 +10,7 @@ class Library { /** * @param {object} response - API response. - * @param {import('./Actions')} actions + * @param {import('../../core/Actions')} actions * @constructor */ constructor(response, actions) { diff --git a/lib/parser/youtube/Search.js b/lib/parser/youtube/Search.js index cd8d02ec..cf4c82ef 100644 --- a/lib/parser/youtube/Search.js +++ b/lib/parser/youtube/Search.js @@ -10,7 +10,7 @@ class Search { /** * @param {object} response - API response. - * @param {import('./Actions')} actions + * @param {import('../../core/Actions')} actions * @param {boolean} is_continuation * @constructor */ diff --git a/lib/parser/youtube/VideoInfo.js b/lib/parser/youtube/VideoInfo.js index 6d9c10eb..7e3e59df 100644 --- a/lib/parser/youtube/VideoInfo.js +++ b/lib/parser/youtube/VideoInfo.js @@ -11,8 +11,8 @@ class VideoInfo { /** * @param {object} data - API response. - * @param {import('./Actions')} actions - * @param {import('./Player')} player + * @param {import('../../core/Actions')} actions + * @param {import('../../core/Player')} player * @constructor */ constructor(data, actions, player) { @@ -28,7 +28,7 @@ class VideoInfo { throw new InnertubeError('This video is unavailable', info.playability_status); /** - * @type {import('../parser/contents/classes/VideoDetails')} + * @type {import('../contents/classes/VideoDetails')} */ this.basic_info = { ...info.video_details, @@ -46,17 +46,17 @@ class VideoInfo { }; /** - * @type {import('../parser/contents/classes/VideoPrimaryInfo')} + * @type {import('../contents/classes/VideoPrimaryInfo')} */ this.primary_info = next.contents.results.get({ type: 'videoPrimaryInfoRenderer' }); /** - * @type {import('../parser/contents/classes/VideoSecondaryInfo')} + * @type {import('../contents/classes/VideoSecondaryInfo')} */ this.secondary_info = next.contents.results.get({ type: 'videoSecondaryInfoRenderer' }); /** - * @type {import('../parser/contents/classes/ChipCloud')} + * @type {import('../contents/classes/ChipCloud')} */ this.related_chip_cloud = next.contents.secondary_results.get({ type: 'relatedChipCloudRenderer' }).content; @@ -64,7 +64,7 @@ class VideoInfo { this.watch_next_feed.pop(); // get rid of the continuation item as it is of no use (for now). /** - * @type {import('../parser/contents/classes/PlayerOverlay')} + * @type {import('../contents/classes/PlayerOverlay')} */ this.player_overlays = next.player_overlays; @@ -76,34 +76,34 @@ class VideoInfo { this.playability_status = info.playability_status; /** - * @type {import('../parser/contents/classes/PlayerAnnotationsExpanded')[]} + * @type {import('../contents/classes/PlayerAnnotationsExpanded')[]} */ this.annotations = info.annotations; /** - * @type {import('../parser/contents/classes/PlayerStoryboardSpec')} + * @type {import('../contents/classes/PlayerStoryboardSpec')} */ this.storyboards = info.storyboards; /** - * @type {import('../parser/contents/classes/Endscreen')} + * @type {import('../contents/classes/Endscreen')} */ this.endscreen = info.endscreen; /** - * @type {import('../parser/contents/classes/PlayerCaptionsTracklist')} + * @type {import('../contents/classes/PlayerCaptionsTracklist')} */ this.captions = info.captions; /** - * @type {import('../parser/contents/classes/CardCollection')} + * @type {import('../contents/classes/CardCollection')} */ this.cards = info.cards; const comments_entry_point = next.contents.results.get({ target_id: 'comments-entry-point' }); /** - * @type {import('../parser/contents/classes/CommentsEntryPointHeader')} + * @type {import('../contents/classes/CommentsEntryPointHeader')} */ this.comments_entry_point_header = comments_entry_point?.contents.get({ type: 'commentsEntryPointHeaderRenderer' }) || {}; } diff --git a/lib/parser/ytmusic/Search.js b/lib/parser/ytmusic/Search.js index 01e43ae1..ed705c11 100644 --- a/lib/parser/ytmusic/Search.js +++ b/lib/parser/ytmusic/Search.js @@ -12,7 +12,7 @@ class Search { /** * @param {object} response - API response. - * @param {import('./Actions')} actions + * @param {import('../../core/Actions')} actions * @param {boolean} is_continuation * @constructor */ @@ -29,14 +29,14 @@ class Search { const item_section = shelves.get({ type: 'itemSectionRenderer' }); /** - * @type {import('../parser/contents/classes/DidYouMean')} + * @type {import('../contents/classes/DidYouMean')} */ - this.did_you_mean = item_section.contents.get({ type: 'didYouMeanRenderer' }) || null; + this.did_you_mean = item_section?.contents.get({ type: 'didYouMeanRenderer' }) || null; /** - * @type {import('../parser/contents/classes/ShowingResultsFor')} + * @type {import('../contents/classes/ShowingResultsFor')} */ - this.showing_results_for = item_section.contents.get({ type: 'showingResultsForRenderer' }) || null; + this.showing_results_for = item_section?.contents.get({ type: 'showingResultsForRenderer' }) || null; this.did_you_mean || this.showing_results_for && shelves.shift(); @@ -81,27 +81,33 @@ class Search { get has_continuation() { return !!this.#continuation; } - + + /** @type {import('../contents/classes/MusicResponsiveListItem')[]} */ get songs() { return this.sections.get({ title: 'Songs' }); } + /** @type {import('../contents/classes/MusicResponsiveListItem')[]} */ get videos() { return this.sections.get({ title: 'Videos' }); } + /** @type {import('../contents/classes/MusicResponsiveListItem')[]} */ get albums() { return this.sections.get({ title: 'Albums' }); } + /** @type {import('../contents/classes/MusicResponsiveListItem')[]} */ get artists() { return this.sections.get({ title: 'Artists' }); } + /** @type {import('../contents/classes/MusicResponsiveListItem')[]} */ get playlists() { return this.sections.get({ title: 'Community playlists' }); } + /** @type {import('../contents/classes/MusicResponsiveListItem')[]} */ get page() { return this.#page; }