diff --git a/lib/channel.js b/lib/channel.js index cbf0649..19fd9e1 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -233,7 +233,8 @@ class Channel extends Model { 'content-length': Buffer.byteLength(postData, 'utf8'), 'x-goog-authuser': '0', 'x-goog-visitor-id': this.session.context.client.visitorData, - 'x-youtube-client-name': '1', + 'x-youtube-bootstrap-logged-in': this.session.loggedIn, + 'x-youtube-client-name': this.session.clientName, 'x-youtube-client-version': this.session.context.client.clientVersion, 'x-origin': 'https://www.youtube.com', }; diff --git a/lib/playlist.js b/lib/playlist.js index 4792a48..38007a8 100644 --- a/lib/playlist.js +++ b/lib/playlist.js @@ -86,7 +86,8 @@ class Playlist extends Model { 'content-length': Buffer.byteLength(postData, 'utf8'), 'x-goog-authuser': '0', 'x-goog-visitor-id': this.session.context.client.visitorData, - 'x-youtube-client-name': '1', + 'x-youtube-bootstrap-logged-in': this.session.loggedIn, + 'x-youtube-client-name': this.session.cientName, 'x-youtube-client-version': this.session.context.client.clientVersion, 'x-origin': 'https://www.youtube.com', }; diff --git a/lib/search.js b/lib/search.js index c399fc6..8e68544 100644 --- a/lib/search.js +++ b/lib/search.js @@ -267,7 +267,8 @@ class Search extends Model { 'content-length': Buffer.byteLength(postData, 'utf8'), 'x-goog-authuser': '0', 'x-goog-visitor-id': this.session.context.client.visitorData, - 'x-youtube-client-name': '1', + 'x-youtube-bootstrap-logged-in': this.session.loggedIn, + 'x-youtube-client-name': this.session.clientName, 'x-youtube-client-version': this.session.context.client.clientVersion, 'x-origin': 'https://www.youtube.com', }; diff --git a/lib/session.js b/lib/session.js index 9232916..773b18a 100644 --- a/lib/session.js +++ b/lib/session.js @@ -22,6 +22,7 @@ class Session extends Model { this.playerUrl = ''; this.loggedIn = false; this.player = {}; + this.clientName = 1; } // process the retrieved innertube configuration object @@ -46,6 +47,14 @@ class Session extends Model { if (this.context && this.context.client) this.context.client.hl = 'en'; this.player = new Player(this); if (this.playerUrl.length) await this.player.fetch(); + this.common.headers['user-agent'] = 'Mozilla/5.0 (Linux; Android) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.109 Safari/537.36 CrKey/1.54.248666'; + this.context.client = { + hl: 'en', + clientName: 'WEB_CREATOR', + clientVersion: '1.20240723.03.00', + visitorData: this.context.client.visitorData, + } + this.clientName = 62; this.status = this.player.status; this.reason = this.player.reason; } catch (e) { diff --git a/lib/video.js b/lib/video.js index 7c95414..351307f 100644 --- a/lib/video.js +++ b/lib/video.js @@ -355,7 +355,8 @@ class Video extends Model { referer: `https://www.youtube.com/watch?v=${this.options.id}`, 'x-goog-authuser': '0', 'x-goog-visitor-id': this.session.context.client.visitorData, - 'x-youtube-client-name': '1', + 'x-youtube-client-name': this.session.clientName, + 'x-youtube-bootstrap-logged-in': this.session.loggedIn, 'x-youtube-client-version': this.session.context.client.clientVersion, 'x-origin': 'https://www.youtube.com', };