From 9a962e441e3dab2192e320a8634901017aecbd90 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sun, 15 Dec 2024 14:16:07 +0900 Subject: [PATCH] fix(YouTube/VideoInformation): Channel name not fetched in YouTube 19.34.42 --- .../youtube/video/information/VideoInformationPatch.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt index 5fff83ae5..9d96c3d1f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt @@ -187,10 +187,14 @@ val videoInformationPatch = bytecodePatch( } } - fun Pair.getPlayerResponseInstruction(returnType: String): String { + fun Pair.getPlayerResponseInstruction(returnType: String, fromString: Boolean? = null): String { methodOrThrow().apply { + val startIndex = if (fromString == true) + matchOrThrow().stringMatches!!.first().index + else + 0 val targetReference = getInstruction( - indexOfFirstInstructionOrThrow { + indexOfFirstInstructionOrThrow(startIndex) { val reference = getReference() (opcode == Opcode.INVOKE_INTERFACE_RANGE || opcode == Opcode.INVOKE_INTERFACE) && reference?.definingClass == PLAYER_RESPONSE_MODEL_CLASS_DESCRIPTOR && @@ -289,7 +293,7 @@ val videoInformationPatch = bytecodePatch( channelIdMethodCall = channelIdFingerprint.getPlayerResponseInstruction("Ljava/lang/String;") channelNameMethodCall = - channelNameFingerprint.getPlayerResponseInstruction("Ljava/lang/String;") + channelNameFingerprint.getPlayerResponseInstruction("Ljava/lang/String;", true) videoIdMethodCall = videoIdFingerprint.getPlayerResponseInstruction("Ljava/lang/String;") videoTitleMethodCall = videoTitleFingerprint.getPlayerResponseInstruction("Ljava/lang/String;")