Files
YouTube.js/src/parser/youtube/History.ts
Luan 9b9fb82131 refactor: Clean up & fix old code
Other changes:
- Renamed "getShortsWatchItem" to "getShortsVideoInfo".
- Fixed `ShortFormVideoInfo`. This never worked for me ever since it was introduced. Turned out it was just implemented incorrectly.
- Moved `basic_info` extraction to `MediaInfo`. Less of a pain to maintain as we only have to modify one file.
- Removed unneeded tsdoc comments.
- Fixed `Innertube#getStreamingData()`. Now it actually returns a deciphered format.
- Simplified some types.
2024-07-30 18:49:24 -03:00

28 lines
994 B
TypeScript

import Feed from '../../core/mixins/Feed.js';
import ItemSection from '../classes/ItemSection.js';
import BrowseFeedActions from '../classes/BrowseFeedActions.js';
import type { Actions, ApiResponse } from '../../core/index.js';
import type { IBrowseResponse } from '../types/index.js';
// TODO: make feed actions usable
export default class History extends Feed<IBrowseResponse> {
sections: ItemSection[];
feed_actions: BrowseFeedActions;
constructor(actions: Actions, data: ApiResponse | IBrowseResponse, already_parsed = false) {
super(actions, data, already_parsed);
this.sections = this.memo.getType(ItemSection);
this.feed_actions = this.memo.getType(BrowseFeedActions).first();
}
/**
* Retrieves next batch of contents.
*/
async getContinuation(): Promise<History> {
const response = await this.getContinuationData();
if (!response)
throw new Error('No continuation data found');
return new History(this.actions, response, true);
}
}