diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/ClientType.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/ClientType.java index b29dce4318..fa4d203640 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/ClientType.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/ClientType.java @@ -41,11 +41,18 @@ public enum ClientType { : "19.47.7", false, true + ), + IOS_MUSIC(26, + "IOS_MUSIC", + "iPhone16,2", + "17.5.1.21F90", + "com.google.ios.youtubemusic/7.08.2 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)", + null, + "7.08.2", + true, + false ); - private static boolean forceAVC() { - return BaseSettings.SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC.get(); - } /** * YouTube @@ -111,4 +118,8 @@ private static boolean forceAVC() { this.canLogin = canLogin; this.useLanguageCode = useLanguageCode; } + + private static boolean forceAVC() { + return BaseSettings.SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC.get(); + } } diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java index 9e61eca990..b3aee59682 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java @@ -22,6 +22,14 @@ public class SpoofVideoStreamsPatch { private static final String UNREACHABLE_HOST_URI_STRING = "https://127.0.0.0"; private static final Uri UNREACHABLE_HOST_URI = Uri.parse(UNREACHABLE_HOST_URI_STRING); + /** + * Injection point. Used by YT Music. + */ + public static void setClientTypeToIosMusic() { + Logger.printDebug(() -> "Setting stream spoofing to: " + ClientType.IOS_MUSIC); + BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.save(ClientType.IOS_MUSIC); + } + /** * Injection point. * Blocks /get_watch requests by returning an unreachable URI. @@ -168,8 +176,7 @@ public static byte[] removeVideoPlaybackPostBody(Uri uri, int method, byte[] pos public static final class SpoofiOSAvailability implements Setting.Availability { @Override public boolean isAvailable() { - return BaseSettings.SPOOF_VIDEO_STREAMS.get() - && BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get() == ClientType.IOS; + return BaseSettings.SPOOF_VIDEO_STREAMS.get() && BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get() == ClientType.IOS; } } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt index 21eb321569..5d25b9d6f1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt @@ -1,7 +1,15 @@ package app.revanced.patches.music.misc.spoof +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patches.music.misc.gms.musicActivityOnCreateFingerprint +import app.revanced.patches.shared.misc.spoof.EXTENSION_CLASS_DESCRIPTOR import app.revanced.patches.shared.misc.spoof.spoofVideoStreamsPatch val spoofVideoStreamsPatch = spoofVideoStreamsPatch({ compatibleWith("com.google.android.apps.youtube.music") +}, { + musicActivityOnCreateFingerprint.method.addInstruction( + 0, + "invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->setClientTypeToIosMusic()V", + ) }) \ No newline at end of file