refactor: clean up, fix & remove outdated code (#228)

* dev: refactor and remove redundant code

* docs(music): update `Library` API ref

* docs: update examples

* chore: update lock file
This commit is contained in:
LuanRT
2022-11-06 03:32:16 -03:00
committed by GitHub
parent 1eda93ee08
commit aa334aacbd
50 changed files with 2006 additions and 2403 deletions

View File

@@ -1,7 +1,8 @@
import { CLIENTS } from '../utils/Constants';
import { u8ToBase64 } from '../utils/Utils';
import { VideoMetadata } from '../core/Studio';
import { ChannelAnalytics, CreateCommentParams, CreateCommentReplyParams, GetCommentsSectionParams, InnertubePayload, LiveMessageParams, MusicSearchFilter, NotificationPreferences, PeformCommentActionParams, SearchFilter, SoundInfoParams } from './youtube';
import { ChannelAnalytics, CreateCommentParams, GetCommentsSectionParams, InnertubePayload, LiveMessageParams, MusicSearchFilter, NotificationPreferences, PeformCommentActionParams, SearchFilter } from './youtube';
class Proto {
static encodeChannelAnalyticsParams(channel_id: string) {
@@ -139,28 +140,6 @@ class Proto {
return encodeURIComponent(u8ToBase64(buf));
}
static encodeCommentRepliesParams(video_id: string, comment_id: string) {
const buf = GetCommentsSectionParams.toBinary({
ctx: {
videoId: video_id
},
unkParam: 6,
params: {
repliesOpts: {
videoId: video_id, commentId: comment_id,
unkopts: {
unkParam: 0
},
unkParam1: 1, unkParam2: 10,
channelId: ' ' // XXX: Seems like this can be omitted
},
target: `comment-replies-item-${comment_id}`
}
});
return encodeURIComponent(u8ToBase64(buf));
}
static encodeCommentParams(video_id: string) {
const buf = CreateCommentParams.toBinary({
videoId: video_id,
@@ -172,18 +151,6 @@ class Proto {
return encodeURIComponent(u8ToBase64(buf));
}
static encodeCommentReplyParams(comment_id: string, video_id: string) {
const buf = CreateCommentReplyParams.toBinary({
videoId: video_id,
commentId: comment_id,
params: {
unkNum: 0
},
unkNum: 7
});
return encodeURIComponent(u8ToBase64(buf));
}
static encodeCommentActionParams(type: number, args: {
comment_id?: string,
video_id?: string,
@@ -312,23 +279,6 @@ class Proto {
return buf;
}
static encodeSoundInfoParams(id: string) {
const data: SoundInfoParams = {
sound: {
params: {
ids: {
id1: id,
id2: id,
id3: id
}
}
}
};
const buf = SoundInfoParams.toBinary(data);
return encodeURIComponent(u8ToBase64(buf));
}
}
export default Proto;

View File

@@ -186,18 +186,6 @@ message CreateCommentParams {
required int32 number = 10;
}
message CreateCommentReplyParams {
required string video_id = 2;
required string comment_id = 4;
message UnknownParams {
required int32 unk_num = 1;
}
required UnknownParams params = 5;
optional int32 unk_num = 10;
}
message PeformCommentActionParams {
required int32 type = 1;
required string comment_id = 3;