fix(YouTube - Spoof video streams): Change default spoofing to iOS, allow setting a default language with Android VR (#4171)

This commit is contained in:
LisoUseInAIKyrios
2024-12-21 00:38:11 +04:00
committed by GitHub
parent 66f8b0c25d
commit 171b4e7e40
11 changed files with 56 additions and 26 deletions

View File

@ -121,3 +121,12 @@ internal val hlsCurrentTimeFingerprint = fingerprint {
HLS_CURRENT_TIME_FEATURE_FLAG
}
}
internal val patchIncludedExtensionMethodFingerprint = fingerprint {
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC)
returns("Z")
parameters()
custom { method, classDef ->
classDef.type == EXTENSION_CLASS_DESCRIPTOR && method.name == "isPatchIncluded"
}
}

View File

@ -13,6 +13,7 @@ import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.insertFeatureFlagBooleanOverride
import app.revanced.util.returnEarly
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
@ -39,6 +40,12 @@ fun spoofVideoStreamsPatch(
dependsOn(addResourcesPatch)
execute {
// region Enable extension helper method used by other patches
patchIncludedExtensionMethodFingerprint.method.returnEarly(true)
// endregion
// region Block /initplayback requests to fall back to /get_watch requests.
val moveUriStringIndex = buildInitPlaybackRequestFingerprint.patternMatch!!.startIndex

View File

@ -37,7 +37,7 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch({
preferences = setOf(
SwitchPreference("revanced_spoof_video_streams"),
ListPreference(
"revanced_spoof_video_streams_client",
"revanced_spoof_video_streams_client_type",
summaryKey = null,
),
ListPreference(
@ -45,8 +45,8 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch({
summaryKey = null
),
SwitchPreference("revanced_spoof_video_streams_ios_force_avc"),
// Preference requires a title but the actual text is chosen at runtime.
NonInteractivePreference(
// Requires a key and title but the actual text is chosen at runtime.
key = "revanced_spoof_video_streams_about_android_vr",
tag = "app.revanced.extension.youtube.settings.preference.SpoofStreamingDataSideEffectsPreference"
),

View File

@ -1,12 +1,12 @@
<resources>
<app id="youtube">
<patch id="misc.fix.playback.spoofVideoStreamsPatch">
<string-array name="revanced_spoof_video_streams_client_entries">
<string-array name="revanced_spoof_video_streams_client_type_entries">
<!-- Operating system names are not translatable, so no need to use strings.xml -->
<item>Android VR</item>
<item>iOS</item>
</string-array>
<string-array name="revanced_spoof_video_streams_client_entry_values">
<string-array name="revanced_spoof_video_streams_client_type_entry_values">
<!-- Enum names from extension -->
<item>ANDROID_VR</item>
<item>IOS</item>

View File

@ -1296,7 +1296,7 @@ Enabling this can unlock higher video qualities"</string>
Video playback may not work"</string>
<string name="revanced_spoof_video_streams_user_dialog_message">Turning off this setting may cause video playback issues.</string>
<string name="revanced_spoof_video_streams_client_title">Default client</string>
<string name="revanced_spoof_video_streams_client_type_title">Default client</string>
<string name="revanced_spoof_video_streams_ios_force_avc_title">Force AVC (H.264)</string>
<string name="revanced_spoof_video_streams_ios_force_avc_summary_on">Video codec is forced to AVC (H.264)</string>
<string name="revanced_spoof_video_streams_ios_force_avc_summary_off">Video codec is determined automatically</string>
@ -1309,7 +1309,8 @@ AVC has a maximum resolution of 1080p, Opus audio codec is not available, and vi
<string name="revanced_spoof_video_streams_about_android_vr_title">Android VR spoofing side effects</string>
<string name="revanced_spoof_video_streams_about_android_vr_summary">"• Kids videos may not play
• Audio track menu is missing
• Stable volume is not available"</string>
• Stable volume is not available
• Force original audio is not available"</string>
<string name="revanced_spoof_video_streams_language_title">Default audio stream language</string>
<string name="revanced_spoof_video_streams_language_DEFAULT">App language</string>
<string name="revanced_spoof_video_streams_language_AR">Arabic</string>