Files
YouTube.js/lib/parser/ytmusic/Album.js
LuanRT 68cb841c00 refactor!: finish parser migration
Finally! :)

This removes all code related to the old parser.

#65
2022-07-11 06:19:10 -03:00

34 lines
801 B
JavaScript

'use strict';
const Parser = require('..');
/** @namespace */
class Album {
#page;
#actions;
/**
* @param {object} response - API response.
* @param {import('../../core/Actions')} actions
*/
constructor(response, actions) {
this.#page = Parser.parseResponse(response.data);
this.#actions = actions;
/** @type {import('../classes/MusicDetailHeader')[]} */
this.header = this.#page.header;
/** @type {string} */
this.url = this.#page.microformat.url_canonical;
/** @type {import('../classes/MusicResponsiveListItem')[]} */
this.contents = this.#page.contents_memo.get('MusicShelf')?.[0].contents;
this.sections = this.#page.contents_memo.get('MusicCarouselShelf') || [];
}
get page() {
return this.#page;
}
}
module.exports = Album;