refactor: Added playerParams (for videos from search)

This commit is contained in:
Georgiy 2023-05-08 13:44:20 +03:00
parent 1a12523bd1
commit 8f5f39dd98
1 changed files with 9 additions and 1 deletions

View File

@ -16,6 +16,7 @@ class Innertube {
constructor(ErrorCallback) {
this.ErrorCallback = ErrorCallback || undefined;
this.retry_count = 0;
this.playerParams = "";
}
checkErrorCallback() {
@ -191,13 +192,14 @@ class Innertube {
data: {
...data,
...{
playerParams: this.playerParams,
contentCheckOk: false,
mwebCapabilities: {
mobileClientSupportsLivestream: true,
},
playbackContext: {
contentPlaybackContext: {
currentUrl: "/watch?v=" + id,
currentUrl: "/watch?v=" + id + "&pp=" + this.playerParams,
vis: 0,
splay: false,
autoCaptionsDefaultOn: false,
@ -370,6 +372,12 @@ class Innertube {
const ownerData = vidMetadata.contents.find(
(content) => content.slimOwnerRenderer
)?.slimOwnerRenderer;
try {
console.log(vidMetadata.contents);
this.playerParams =
ownerData.navigationEndpoint.watchEndpoint.playerParams;
} catch (e) {}
const vidData = {
id: details.videoId,
title: details.title,