avoid decipher on ios and android

This commit is contained in:
Emilien Devos 2024-10-23 23:22:06 +02:00
parent 3b3ab33b54
commit 608f177bcb

View file

@ -32,35 +32,38 @@ export const youtubePlayerParsing = async (
// Modify the original YouTube response to include deciphered URLs // Modify the original YouTube response to include deciphered URLs
if (streamingData && videoData && videoData.streamingData) { if (streamingData && videoData && videoData.streamingData) {
streamingData.adaptive_formats; const ecatcherServiceTracking = videoData.responseContext?.serviceTrackingParams.find(o => o.service === 'ECATCHER');
for (const [index, format] of streamingData.formats.entries()) { const clientNameUsed = ecatcherServiceTracking?.params?.find(o => o.key === 'client.name');
videoData.streamingData.formats[index].url = format.decipher( if (clientNameUsed?.value.includes("IOS") || clientNameUsed?.value.includes("ANDROID")) {
innertubeClient.session.player, for (const [index, format] of streamingData.formats.entries()) {
); videoData.streamingData.formats[index].url = format.decipher(
if ( innertubeClient.session.player,
videoData.streamingData.formats[index].signatureCipher !== );
undefined if (
) { videoData.streamingData.formats[index].signatureCipher !==
delete videoData.streamingData.formats[index] undefined
.signatureCipher; ) {
delete videoData.streamingData.formats[index]
.signatureCipher;
}
} }
} for (
for ( const [index, adaptive_format] of streamingData.adaptive_formats
const [index, adaptive_format] of streamingData.adaptive_formats .entries()
.entries()
) {
videoData.streamingData.adaptiveFormats[index].url =
adaptive_format
.decipher(
innertubeClient.session.player,
);
if (
videoData.streamingData.adaptiveFormats[index]
.signatureCipher !==
undefined
) { ) {
delete videoData.streamingData.adaptiveFormats[index] videoData.streamingData.adaptiveFormats[index].url =
.signatureCipher; adaptive_format
.decipher(
innertubeClient.session.player,
);
if (
videoData.streamingData.adaptiveFormats[index]
.signatureCipher !==
undefined
) {
delete videoData.streamingData.adaptiveFormats[index]
.signatureCipher;
}
} }
} }
} }