mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
* feat(utils): Add logger * chore: Clean up some classes and add more logging * chore: Fix conflicts
21 lines
575 B
TypeScript
21 lines
575 B
TypeScript
import { Parser } from '../index.js';
|
|
import Element from '../classes/Element.js';
|
|
import type { ApiResponse } from '../../core/index.js';
|
|
import type { IBrowseResponse } from '../types/index.js';
|
|
|
|
class Analytics {
|
|
#page: IBrowseResponse;
|
|
sections;
|
|
|
|
constructor(response: ApiResponse) {
|
|
this.#page = Parser.parseResponse<IBrowseResponse>(response.data);
|
|
this.sections = this.#page.contents_memo?.getType(Element).map((el) => el.model).flatMap((el) => !el ? [] : el);
|
|
}
|
|
|
|
get page(): IBrowseResponse {
|
|
return this.#page;
|
|
}
|
|
}
|
|
|
|
export default Analytics;
|