mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-07-02 21:52:48 +00:00
refactor(parser): Remove unused analytics nodes
These were once useful when it was still possible to use the Android client with OAuth.
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
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';
|
||||
|
||||
export default 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;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import { Parser } from '../index.js';
|
||||
import ItemSection from '../classes/ItemSection.js';
|
||||
import SectionList from '../classes/SectionList.js';
|
||||
import SingleColumnBrowseResults from '../classes/SingleColumnBrowseResults.js';
|
||||
|
||||
import { InnertubeError } from '../../utils/Utils.js';
|
||||
import type { ApiResponse } from '../../core/index.js';
|
||||
import type { ObservedArray } from '../helpers.js';
|
||||
import type { IBrowseResponse } from '../types/index.js';
|
||||
|
||||
export default class TimeWatched {
|
||||
#page: IBrowseResponse;
|
||||
contents?: ObservedArray<ItemSection>;
|
||||
|
||||
constructor(response: ApiResponse) {
|
||||
this.#page = Parser.parseResponse<IBrowseResponse>(response.data);
|
||||
|
||||
if (!this.#page.contents)
|
||||
throw new InnertubeError('Page contents not found');
|
||||
|
||||
const tab = this.#page.contents.item().as(SingleColumnBrowseResults).tabs.get({ selected: true });
|
||||
|
||||
if (!tab)
|
||||
throw new InnertubeError('Could not find target tab.');
|
||||
|
||||
this.contents = tab.content?.as(SectionList).contents.as(ItemSection);
|
||||
}
|
||||
|
||||
get page(): IBrowseResponse {
|
||||
return this.#page;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
export { default as AccountInfo } from './AccountInfo.js';
|
||||
export { default as Analytics } from './Analytics.js';
|
||||
export { default as Channel } from './Channel.js';
|
||||
export * from './Channel.js';
|
||||
export { default as Comments } from './Comments.js';
|
||||
@@ -15,6 +14,5 @@ export { default as Playlist } from './Playlist.js';
|
||||
export { default as Search } from './Search.js';
|
||||
export { default as Settings } from './Settings.js';
|
||||
export { default as SmoothedQueue } from './SmoothedQueue.js';
|
||||
export { default as TimeWatched } from './TimeWatched.js';
|
||||
export { default as VideoInfo } from './VideoInfo.js';
|
||||
export { default as TranscriptInfo } from './TranscriptInfo.js';
|
||||
Reference in New Issue
Block a user