fix(YouTube - Spoof streaming data): Skip response encryption in OnesiePlayerRequest https://github.com/ReVanced/revanced-patches/pull/4521

This commit is contained in:
inotia00 2025-03-06 12:02:58 +09:00
parent 1cfe69ab47
commit 00ff1b5ec5
3 changed files with 37 additions and 1 deletions

View File

@ -106,4 +106,18 @@ public class BlockRequestPatch {
return initPlaybackRequestUri; return initPlaybackRequestUri;
} }
/**
* Injection point.
* Skip response encryption in OnesiePlayerRequest.
*/
public static boolean skipResponseEncryption(boolean original) {
Logger.printDebug(() -> "response Encryption: " + original);
if (BLOCK_REQUEST) {
return false;
}
return original;
}
} }

View File

@ -4,9 +4,10 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.shared.extension.Constants.SPOOF_PATH import app.revanced.patches.shared.extension.Constants.SPOOF_PATH
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
import app.revanced.util.fingerprint.methodOrThrow import app.revanced.util.fingerprint.methodOrThrow
import app.revanced.util.fingerprint.resolvable
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
const val EXTENSION_CLASS_DESCRIPTOR = const val EXTENSION_CLASS_DESCRIPTOR =
"$SPOOF_PATH/BlockRequestPatch;" "$SPOOF_PATH/BlockRequestPatch;"
@ -50,5 +51,16 @@ val blockRequestPatch = bytecodePatch(
} }
// endregion // endregion
// region Skip response encryption in OnesiePlayerRequest
if (onesieEncryptionFeatureFlagFingerprint.resolvable()) {
onesieEncryptionFeatureFlagFingerprint.injectLiteralInstructionBooleanCall(
ONESIE_ENCRYPTION_FEATURE_FLAG,
"$EXTENSION_CLASS_DESCRIPTOR->skipResponseEncryption(Z)Z"
)
}
// endregion
} }
} }

View File

@ -41,3 +41,13 @@ internal fun indexOfUriToStringInstruction(method: Method) =
getReference<MethodReference>().toString() == "Landroid/net/Uri;->toString()Ljava/lang/String;" getReference<MethodReference>().toString() == "Landroid/net/Uri;->toString()Ljava/lang/String;"
} }
// Feature flag that turns on Platypus programming language code compiled to native C++.
// This code appears to replace the player config after the streams are loaded.
// Flag is present in YouTube 19.34, but is missing Platypus stream replacement code until 19.43.
// Flag and Platypus code is also present in newer versions of YouTube Music.
internal const val ONESIE_ENCRYPTION_FEATURE_FLAG = 45645570L
internal val onesieEncryptionFeatureFlagFingerprint = legacyFingerprint(
name = "onesieEncryptionFeatureFlagFingerprint",
literals = listOf(ONESIE_ENCRYPTION_FEATURE_FLAG),
)