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.
This commit is contained in:
Luan
2024-07-30 18:49:24 -03:00
parent 3153375bca
commit 9b9fb82131
52 changed files with 362 additions and 557 deletions

View File

@@ -301,7 +301,7 @@ export type CreateVideoEndpointOptions = {
client?: InnerTubeClient;
}
export type ICreateVideoRequest = ObjectSnakeToCamel<CreateVideoEndpointOptions>;
export type ICreateVideoRequest = Omit<ObjectSnakeToCamel<CreateVideoEndpointOptions>, 'client'>;
export type CreatePlaylistEndpointOptions = {
/**
@@ -343,16 +343,7 @@ export type EditPlaylistEndpointOptions = {
}[];
}
export interface IEditPlaylistRequest extends ObjectSnakeToCamel<EditPlaylistEndpointOptions> {
actions: {
action: 'ACTION_ADD_VIDEO' | 'ACTION_REMOVE_VIDEO' | 'ACTION_MOVE_VIDEO_AFTER' | 'ACTION_SET_PLAYLIST_DESCRIPTION' | 'ACTION_SET_PLAYLIST_NAME';
addedVideoId?: string;
setVideoId?: string;
movedSetVideoIdPredecessor?: string;
playlistDescription?: string;
playlistName?: string;
}[];
}
export type IEditPlaylistRequest = ObjectSnakeToCamel<EditPlaylistEndpointOptions>;
export type BlocklistPickerRequestEndpointOptions = {
channel_id: string;
@@ -364,19 +355,21 @@ export type IBlocklistPickerRequest = {
}
}
export interface IReelWatchRequest {
export interface IReelItemWatchRequest {
disablePlayerResponse: boolean;
playerRequest: {
videoId: string,
params: string,
},
params?: string;
client?: InnerTubeClient;
}
export type ReelWatchEndpointOptions = {
export type ReelItemWatchEndpointOptions = {
/**
* The shorts ID.
*/
short_id: string;
video_id: string;
/**
* The client to use.
*/
@@ -387,7 +380,7 @@ export type ReelWatchEndpointOptions = {
params?: string;
}
export interface IReelSequenceRequest {
export interface IReelWatchSequenceRequest {
sequenceParams: string;
}
@@ -395,7 +388,7 @@ export type ReelWatchSequenceEndpointOptions = {
/**
* The protobuf parameters.
*/
sequenceParams: string;
sequence_params: string;
/**
* The client to use.
*/