Skip to content

Commit

Permalink
Merge pull request #66 from gatecrasher777/2.5.5
Browse files Browse the repository at this point in the history
Bypassing 403 on videos > 1 minute
  • Loading branch information
gatecrasher777 authored Oct 18, 2024
2 parents 9bcc25b + 7bbf8e1 commit 5fd7698
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
3 changes: 2 additions & 1 deletion lib/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
3 changes: 2 additions & 1 deletion lib/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
9 changes: 9 additions & 0 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Session extends Model {
this.playerUrl = '';
this.loggedIn = false;
this.player = {};
this.clientName = 1;
}

// process the retrieved innertube configuration object
Expand All @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion lib/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down

0 comments on commit 5fd7698

Please sign in to comment.