mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-30 09:55:18 +00:00
hotfix: use Android client when requesting initial video info
This commit is contained in:
@@ -36,12 +36,11 @@ class Format {
|
||||
|
||||
/**
|
||||
* Decipher the streaming url of the format.
|
||||
*
|
||||
* @param {import('../../../core/Player').default} player
|
||||
* @returns {string} Deciphered URL for downloading
|
||||
*/
|
||||
decipher(player) {
|
||||
return player.decipher(this.url, this.signature_cipher, this.cipher);
|
||||
decipher() {
|
||||
return this.url;
|
||||
// Return player.decipher(this.url, this.signature_cipher, this.cipher);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import Player from '../../core/Player';
|
||||
import TwoColumnWatchNextResults from '../classes/TwoColumnWatchNextResults';
|
||||
import VideoPrimaryInfo from '../classes/VideoPrimaryInfo';
|
||||
import VideoSecondaryInfo from '../classes/VideoSecondaryInfo';
|
||||
import PlayerMicroformat from '../classes/PlayerMicroformat';
|
||||
import Format from '../classes/misc/Format';
|
||||
|
||||
import MerchandiseShelf from '../classes/MerchandiseShelf';
|
||||
@@ -96,22 +95,8 @@ class VideoInfo {
|
||||
if (info.playability_status?.status === 'ERROR')
|
||||
throw new InnertubeError('This video is unavailable', info.playability_status);
|
||||
|
||||
if (!info.microformat?.is(PlayerMicroformat))
|
||||
throw new InnertubeError('Invalid microformat', info.microformat);
|
||||
|
||||
this.basic_info = { // This type is inferred so no need for an explicit type
|
||||
...info.video_details,
|
||||
...{
|
||||
/**
|
||||
* Microformat is a bit redundant, so only
|
||||
* a few things there are interesting to us.
|
||||
*/
|
||||
embed: info.microformat?.embed,
|
||||
channel: info.microformat?.channel,
|
||||
is_unlisted: info.microformat?.is_unlisted,
|
||||
is_family_safe: info.microformat?.is_family_safe,
|
||||
has_ypc_metadata: info.microformat?.has_ypc_metadata
|
||||
},
|
||||
like_count: undefined as number | undefined,
|
||||
is_liked: undefined as boolean | undefined,
|
||||
is_disliked: undefined as boolean | undefined
|
||||
@@ -438,7 +423,7 @@ class VideoInfo {
|
||||
if (!format.index_range || !format.init_range)
|
||||
throw new InnertubeError('Index and init ranges not available', { format });
|
||||
|
||||
const url = new URL(format.decipher(this.#player));
|
||||
const url = new URL(format.decipher());
|
||||
url.searchParams.set('cpn', this.#cpn);
|
||||
|
||||
set.appendChild(this.#el(document, 'Representation', {
|
||||
|
||||
Reference in New Issue
Block a user