Skip to content

Commit

Permalink
fix: decipher n param only if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Mar 7, 2022
1 parent 6e1e966 commit 459c305
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Innertube.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,10 @@ class Innertube {
const url_components = new URL(format.url);
url_components.searchParams.set('cver', this.context.client.clientVersion);
url_components.searchParams.set('ratebypass', 'yes');
url_components.searchParams.set('n', new NToken(this.#player.ntoken_sc).transform(url_components.searchParams.get('n')));

if (url_components.searchParams.get('n')) {
url_components.searchParams.set('n', new NToken(this.#player.ntoken_sc).transform(url_components.searchParams.get('n')));
}

format.url = url_components.toString();
format.has_audio = !!format.audioBitrate || !!format.audioQuality;
Expand Down

0 comments on commit 459c305

Please sign in to comment.