From d6bdef650ffaab2ca4da99e14e8b9ecea089f83f Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 6 Apr 2024 01:12:24 +0900 Subject: [PATCH] rollback: `fix player tracking such as history or video watchtime` --- .../parameter/SpoofPlayerParameterPatch.kt | 36 ------------------- .../fingerprints/ParamsMapPutFingerprint.kt | 24 ------------- .../StatsQueryParameterFingerprint.kt | 7 ---- 3 files changed, 67 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/ParamsMapPutFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/StatsQueryParameterFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/SpoofPlayerParameterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/SpoofPlayerParameterPatch.kt index 1a5cffbe5..b2a3df4e9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/SpoofPlayerParameterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/SpoofPlayerParameterPatch.kt @@ -5,13 +5,10 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction -import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.ParamsMapPutFingerprint import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerResponseModelGeneralStoryboardRendererFingerprint import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerResponseModelLiveStreamStoryboardRendererFingerprint import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerResponseModelStoryboardRecommendedLevelFingerprint -import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StatsQueryParameterFingerprint import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardRendererDecoderRecommendedLevelFingerprint import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardRendererDecoderSpecFingerprint import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardRendererSpecFingerprint @@ -25,7 +22,6 @@ import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.patches.youtube.utils.videoid.general.VideoIdPatch import app.revanced.util.patch.BaseBytecodePatch import app.revanced.util.resultOrThrow -import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Suppress("unused") @@ -40,11 +36,9 @@ object SpoofPlayerParameterPatch : BaseBytecodePatch( ), compatiblePackages = COMPATIBLE_PACKAGE, fingerprints = setOf( - ParamsMapPutFingerprint, PlayerResponseModelGeneralStoryboardRendererFingerprint, PlayerResponseModelLiveStreamStoryboardRendererFingerprint, PlayerResponseModelStoryboardRecommendedLevelFingerprint, - StatsQueryParameterFingerprint, StoryboardRendererDecoderRecommendedLevelFingerprint, StoryboardRendererDecoderSpecFingerprint, StoryboardRendererSpecFingerprint, @@ -173,36 +167,6 @@ object SpoofPlayerParameterPatch : BaseBytecodePatch( ) } - // Fix stats not being tracked. - // Due to signature spoofing "adformat" is present in query parameters made for /stats requests, - // even though, for regular videos, it should not be. - // This breaks stats tracking. - // Replace the ad parameter with the video parameter in the query parameters. - StatsQueryParameterFingerprint.resultOrThrow().let { - val putMethod = ParamsMapPutFingerprint.resultOrThrow().method.toString() - - it.mutableMethod.apply { - val adParamIndex = it.scanResult.stringsScanResult!!.matches.first().index - val videoParamIndex = adParamIndex + 3 - - // Replace the ad parameter with the video parameter. - replaceInstruction(adParamIndex, getInstruction(videoParamIndex)) - - // Call paramsMap.put instead of paramsMap.putIfNotExist - // because the key is already present in the map. - val putAdParamIndex = adParamIndex + 1 - val putIfKeyNotExistsInstruction = getInstruction(putAdParamIndex) - replaceInstruction( - putAdParamIndex, - "invoke-virtual { " + - "v${putIfKeyNotExistsInstruction.registerC}, " + - "v${putIfKeyNotExistsInstruction.registerD}, " + - "v${putIfKeyNotExistsInstruction.registerE} }, " + - putMethod, - ) - } - } - /** * Add settings */ diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/ParamsMapPutFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/ParamsMapPutFingerprint.kt deleted file mode 100644 index 8c8e0711a..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/ParamsMapPutFingerprint.kt +++ /dev/null @@ -1,24 +0,0 @@ -package app.revanced.patches.youtube.utils.fix.parameter.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.MethodFingerprint -import com.android.tools.smali.dexlib2.AccessFlags -import com.android.tools.smali.dexlib2.Opcode - -internal object ParamsMapPutFingerprint : MethodFingerprint( - returnType = "V", - accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - parameters = listOf( - "Ljava/lang/String;", - "Ljava/lang/String;", - ), - opcodes = listOf( - Opcode.CONST_4, - Opcode.CONST_4, - Opcode.CONST_4, - Opcode.MOVE_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.MOVE_OBJECT, - Opcode.INVOKE_DIRECT_RANGE, - ), -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/StatsQueryParameterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/StatsQueryParameterFingerprint.kt deleted file mode 100644 index 08a05e6a9..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/parameter/fingerprints/StatsQueryParameterFingerprint.kt +++ /dev/null @@ -1,7 +0,0 @@ -package app.revanced.patches.youtube.utils.fix.parameter.fingerprints - -import app.revanced.patcher.fingerprint.MethodFingerprint - -internal object StatsQueryParameterFingerprint : MethodFingerprint( - strings = listOf("adunit"), -) \ No newline at end of file