From 7086bf5d66695dc8baa3862da43d90348fc674f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ho=C3=A0ng=20Gia=20B=E1=BA=A3o?=
<70064328+YT-Advanced@users.noreply.github.com>
Date: Sat, 9 Nov 2024 22:09:27 +0700
Subject: [PATCH 1/4] Update strings
---
src/main/resources/youtube/settings/host/values/strings.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index 409b17e620..34455a5636 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -1829,7 +1829,6 @@ Tap on the continue button and disable battery optimizations."
Web
Spoofing side effects
"• Movies or paid videos may not play.
-• Livestreams start from the beginning.
• Videos may end 1 second early.
• Opus audio codec may not be supported."
"• Videos may end 1 second early.
@@ -1840,7 +1839,7 @@ Tap on the continue button and disable battery optimizations."
• Stable volume is not available."
• Video may not play.
iOS Compatibility mode
- Only spoofed as iOS client if it is not a movie, paid video or livestream.
+ Only spoofed as iOS client if it is not a movie or paid video.
Always spoofed as iOS client.
Force iOS AVC (H.264)
iOS video codec is AVC (H.264).
From ef090abfeeb2dedfc9870b204bcb2c697987e2c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ho=C3=A0ng=20Gia=20B=E1=BA=A3o?=
<70064328+YT-Advanced@users.noreply.github.com>
Date: Mon, 11 Nov 2024 13:03:09 +0700
Subject: [PATCH 2/4] fix(YouTube - Spoof Streaming Data): Log out the iOS
client to allow video playback
---
.../streamingdata/SpoofStreamingDataPatch.kt | 28 +++++++++++++++++++
.../TimeBarLiveLabelFingerprint.kt | 13 +++++++++
.../utils/resourceid/SharedResourceIdPatch.kt | 2 ++
.../youtube/settings/host/values/strings.xml | 8 +-----
.../youtube/settings/xml/revanced_prefs.xml | 1 -
5 files changed, 44 insertions(+), 8 deletions(-)
create mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt
index 1e17d95f99..cf9c4f038e 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt
@@ -1,6 +1,7 @@
package app.revanced.patches.youtube.utils.fix.streamingdata
import app.revanced.patcher.data.BytecodeContext
+import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@@ -15,10 +16,12 @@ import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.BuildPl
import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.CreateStreamingDataFingerprint
import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.NerdsStatsVideoFormatBuilderFingerprint
import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.ProtobufClassParseByteBufferFingerprint
+import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.TimeBarLiveLabelFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.findOpcodeIndicesReversed
import app.revanced.util.getReference
+import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.patch.BaseBytecodePatch
import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.Opcode
@@ -26,6 +29,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
+import com.android.tools.smali.dexlib2.iface.reference.MethodReference
object SpoofStreamingDataPatch : BaseBytecodePatch(
name = "Spoof streaming data",
@@ -45,6 +49,9 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
// Nerds stats video format.
NerdsStatsVideoFormatBuilderFingerprint,
+
+ // `Live` label in player time bar.
+ TimeBarLiveLabelFingerprint,
)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
@@ -236,6 +243,27 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
// endregion
+ // region Sync livestream time.
+ // This is needed when using iOS client as streaming data source.
+
+ TimeBarLiveLabelFingerprint.resultOrThrow().mutableMethod.apply {
+ val targetIndex = indexOfFirstInstructionOrThrow {
+ opcode == Opcode.INVOKE_VIRTUAL &&
+ getReference()?.definingClass == "Landroid/widget/TextView;" &&
+ getReference()?.name == "setOnClickListener"
+ }
+
+ val targetRegister =
+ getInstruction(targetIndex).registerC
+
+ addInstruction(
+ targetIndex + 1,
+ "invoke-static { v$targetRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->syncLivestreamTime(Landroid/widget/TextView;)V"
+ )
+ }
+
+ // endregion
+
/**
* Add settings
*/
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt
new file mode 100644
index 0000000000..d65efa6498
--- /dev/null
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt
@@ -0,0 +1,13 @@
+package app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints
+
+import app.revanced.patcher.extensions.or
+import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.TimeBarLiveLabel
+import app.revanced.util.fingerprint.LiteralValueFingerprint
+import com.android.tools.smali.dexlib2.AccessFlags
+
+internal object TimeBarLiveLabelFingerprint : LiteralValueFingerprint(
+ accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
+ returnType = "V",
+ parameters = listOf("Landroid/view/View;"),
+ literalSupplier = { TimeBarLiveLabel },
+)
\ No newline at end of file
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
index db6bd75fd1..150ef0cda7 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
@@ -107,6 +107,7 @@ object SharedResourceIdPatch : ResourcePatch() {
var SubtitleMenuSettingsFooterInfo = -1L
var SuggestedAction = -1L
var TapBloomView = -1L
+ var TimeBarLiveLabel = -1L
var TitleAnchor = -1L
var ToolTipContentView = -1L
var TotalTime = -1L
@@ -220,6 +221,7 @@ object SharedResourceIdPatch : ResourcePatch() {
SubtitleMenuSettingsFooterInfo = getId(STRING, "subtitle_menu_settings_footer_info")
SuggestedAction = getId(LAYOUT, "suggested_action")
TapBloomView = getId(ID, "tap_bloom_view")
+ TimeBarLiveLabel = getId(ID, "time_bar_live_label")
TitleAnchor = getId(ID, "title_anchor")
ToolTipContentView = getId(LAYOUT, "tooltip_content_view")
TotalTime = getId(STRING, "total_time")
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index 9fe8bda050..331fb2f448 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -1828,19 +1828,13 @@ Tap on the continue button and disable battery optimizations."
TV HTML5
Web
Spoofing side effects
- "• Movies or paid videos may not play.
-• Videos may end 1 second early.
-• OPUS audio codec may not be supported."
- "• Videos may end 1 second early.
+ "• Videos may end 1 second early.
• OPUS audio codec may not be supported."
"• Audio track menu is missing.
• Stable volume is not available."
"• Audio track menu is missing.
• Stable volume is not available."
• Video may not play.
- iOS Compatibility mode
- Only spoofed as iOS client if it is not a movie or paid video.
- Always spoofed as iOS client.
Force iOS AVC (H.264)
iOS video codec is AVC (H.264).
iOS video codec is AVC (H.264), VP9, or AV1.
diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index c5e4ac9648..afed1f3d67 100644
--- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -735,7 +735,6 @@
-
SETTINGS: SPOOF_STREAMING_DATA -->
From 9f34a6bf528f76a385e2a2200a87eade753a181c Mon Sep 17 00:00:00 2001
From: inotia00 <108592928+inotia00@users.noreply.github.com>
Date: Thu, 5 Dec 2024 10:11:18 +0900
Subject: [PATCH 3/4] revert `iOS Compatibility mode` and remove
`syncLivestreamTime`
---
.../streamingdata/SpoofStreamingDataPatch.kt | 28 -------------------
.../TimeBarLiveLabelFingerprint.kt | 13 ---------
.../utils/resourceid/SharedResourceIdPatch.kt | 2 --
.../youtube/settings/host/values/strings.xml | 9 ++++--
.../youtube/settings/xml/revanced_prefs.xml | 1 +
5 files changed, 8 insertions(+), 45 deletions(-)
delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt
index cf9c4f038e..1e17d95f99 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/SpoofStreamingDataPatch.kt
@@ -1,7 +1,6 @@
package app.revanced.patches.youtube.utils.fix.streamingdata
import app.revanced.patcher.data.BytecodeContext
-import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@@ -16,12 +15,10 @@ import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.BuildPl
import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.CreateStreamingDataFingerprint
import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.NerdsStatsVideoFormatBuilderFingerprint
import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.ProtobufClassParseByteBufferFingerprint
-import app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints.TimeBarLiveLabelFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.findOpcodeIndicesReversed
import app.revanced.util.getReference
-import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.patch.BaseBytecodePatch
import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.Opcode
@@ -29,7 +26,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
-import com.android.tools.smali.dexlib2.iface.reference.MethodReference
object SpoofStreamingDataPatch : BaseBytecodePatch(
name = "Spoof streaming data",
@@ -49,9 +45,6 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
// Nerds stats video format.
NerdsStatsVideoFormatBuilderFingerprint,
-
- // `Live` label in player time bar.
- TimeBarLiveLabelFingerprint,
)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
@@ -243,27 +236,6 @@ object SpoofStreamingDataPatch : BaseBytecodePatch(
// endregion
- // region Sync livestream time.
- // This is needed when using iOS client as streaming data source.
-
- TimeBarLiveLabelFingerprint.resultOrThrow().mutableMethod.apply {
- val targetIndex = indexOfFirstInstructionOrThrow {
- opcode == Opcode.INVOKE_VIRTUAL &&
- getReference()?.definingClass == "Landroid/widget/TextView;" &&
- getReference()?.name == "setOnClickListener"
- }
-
- val targetRegister =
- getInstruction(targetIndex).registerC
-
- addInstruction(
- targetIndex + 1,
- "invoke-static { v$targetRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->syncLivestreamTime(Landroid/widget/TextView;)V"
- )
- }
-
- // endregion
-
/**
* Add settings
*/
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt
deleted file mode 100644
index d65efa6498..0000000000
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/streamingdata/fingerprints/TimeBarLiveLabelFingerprint.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package app.revanced.patches.youtube.utils.fix.streamingdata.fingerprints
-
-import app.revanced.patcher.extensions.or
-import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.TimeBarLiveLabel
-import app.revanced.util.fingerprint.LiteralValueFingerprint
-import com.android.tools.smali.dexlib2.AccessFlags
-
-internal object TimeBarLiveLabelFingerprint : LiteralValueFingerprint(
- accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
- returnType = "V",
- parameters = listOf("Landroid/view/View;"),
- literalSupplier = { TimeBarLiveLabel },
-)
\ No newline at end of file
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
index 150ef0cda7..db6bd75fd1 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
@@ -107,7 +107,6 @@ object SharedResourceIdPatch : ResourcePatch() {
var SubtitleMenuSettingsFooterInfo = -1L
var SuggestedAction = -1L
var TapBloomView = -1L
- var TimeBarLiveLabel = -1L
var TitleAnchor = -1L
var ToolTipContentView = -1L
var TotalTime = -1L
@@ -221,7 +220,6 @@ object SharedResourceIdPatch : ResourcePatch() {
SubtitleMenuSettingsFooterInfo = getId(STRING, "subtitle_menu_settings_footer_info")
SuggestedAction = getId(LAYOUT, "suggested_action")
TapBloomView = getId(ID, "tap_bloom_view")
- TimeBarLiveLabel = getId(ID, "time_bar_live_label")
TitleAnchor = getId(ID, "title_anchor")
ToolTipContentView = getId(LAYOUT, "tooltip_content_view")
TotalTime = getId(STRING, "total_time")
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index 331fb2f448..6ffb350f0b 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -1828,13 +1828,18 @@ Tap on the continue button and disable battery optimizations."
TV HTML5
Web
Spoofing side effects
- "• Videos may end 1 second early.
-• OPUS audio codec may not be supported."
+ "• Movies or paid videos may not play.
+• Livestreams start from the beginning.
+• Videos may end 1 second early."
+ • Videos may end 1 second early.
"• Audio track menu is missing.
• Stable volume is not available."
"• Audio track menu is missing.
• Stable volume is not available."
• Video may not play.
+ iOS Compatibility mode
+ Only spoofed as iOS client if it is not a movie, paid video, or livestream.
+ Always spoofed as iOS client.
Force iOS AVC (H.264)
iOS video codec is AVC (H.264).
iOS video codec is AVC (H.264), VP9, or AV1.
diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index afed1f3d67..c5e4ac9648 100644
--- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -735,6 +735,7 @@
+
SETTINGS: SPOOF_STREAMING_DATA -->
From df6de90d73707ca65c779c2c6ccf0b8d93b874d4 Mon Sep 17 00:00:00 2001
From: inotia00 <108592928+inotia00@users.noreply.github.com>
Date: Thu, 5 Dec 2024 10:18:46 +0900
Subject: [PATCH 4/4] chore: remove unused client and update hardcoded client
---
src/main/resources/youtube/settings/host/values/strings.xml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index 6ffb350f0b..cca5ba203c 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -1819,14 +1819,8 @@ Tap on the continue button and disable battery optimizations."
Turning off this setting may cause video playback issues.
Default client
iOS
- Android
- Android Creator
- Android Embedded Player
- Android Testsuite
Android TV
Android VR
- TV HTML5
- Web
Spoofing side effects
"• Movies or paid videos may not play.
• Livestreams start from the beginning.