refactor(YouTube - Spoof video streams): Add 'supportsMultiAudioTracks' field
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ public class ForceOriginalAudioPatch {
|
|||||||
/**
|
/**
|
||||||
* Injection point.
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static void setPreferredLanguage() {
|
public static void setEnabled() {
|
||||||
app.revanced.extension.shared.patches.ForceOriginalAudioPatch.setEnabled(
|
app.revanced.extension.shared.patches.ForceOriginalAudioPatch.setEnabled(
|
||||||
Settings.FORCE_ORIGINAL_AUDIO.get(),
|
Settings.FORCE_ORIGINAL_AUDIO.get(),
|
||||||
Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get()
|
Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get()
|
||||||
|
|||||||
+2
-4
@@ -10,14 +10,12 @@ public class ForceOriginalAudioPatch {
|
|||||||
|
|
||||||
private static final String DEFAULT_AUDIO_TRACKS_SUFFIX = ".4";
|
private static final String DEFAULT_AUDIO_TRACKS_SUFFIX = ".4";
|
||||||
|
|
||||||
private static volatile boolean enabled = false;
|
private static volatile boolean enabled;
|
||||||
|
|
||||||
public static void setEnabled(boolean isEnabled, ClientType client) {
|
public static void setEnabled(boolean isEnabled, ClientType client) {
|
||||||
enabled = isEnabled;
|
enabled = isEnabled;
|
||||||
|
|
||||||
if (isEnabled
|
if (isEnabled && !client.useAuth && !client.supportsMultiAudioTracks) {
|
||||||
&& SpoofVideoStreamsPatch.spoofingToClientWithNoMultiAudioStreams()
|
|
||||||
&& !client.useAuth) {
|
|
||||||
// If client spoofing does not use authentication and lacks multi-audio streams,
|
// If client spoofing does not use authentication and lacks multi-audio streams,
|
||||||
// then can use any language code for the request and if that requested language is
|
// then can use any language code for the request and if that requested language is
|
||||||
// not available YT uses the original audio language. Authenticated requests ignore
|
// not available YT uses the original audio language. Authenticated requests ignore
|
||||||
|
|||||||
+14
@@ -31,6 +31,7 @@ public enum ClientType {
|
|||||||
"132.0.6808.3",
|
"132.0.6808.3",
|
||||||
"1.61.48",
|
"1.61.48",
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
"Android VR 1.61"
|
"Android VR 1.61"
|
||||||
),
|
),
|
||||||
/**
|
/**
|
||||||
@@ -50,6 +51,7 @@ public enum ClientType {
|
|||||||
"107.0.5284.2",
|
"107.0.5284.2",
|
||||||
"1.43.32",
|
"1.43.32",
|
||||||
ANDROID_VR_1_61_48.useAuth,
|
ANDROID_VR_1_61_48.useAuth,
|
||||||
|
ANDROID_VR_1_61_48.supportsMultiAudioTracks,
|
||||||
"Android VR 1.43"
|
"Android VR 1.43"
|
||||||
),
|
),
|
||||||
/**
|
/**
|
||||||
@@ -69,6 +71,7 @@ public enum ClientType {
|
|||||||
"132.0.6779.0",
|
"132.0.6779.0",
|
||||||
"23.47.101",
|
"23.47.101",
|
||||||
true,
|
true,
|
||||||
|
false,
|
||||||
"Android Studio"
|
"Android Studio"
|
||||||
),
|
),
|
||||||
/**
|
/**
|
||||||
@@ -83,6 +86,7 @@ public enum ClientType {
|
|||||||
"0.1",
|
"0.1",
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15",
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15",
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
"visionOS"
|
"visionOS"
|
||||||
),
|
),
|
||||||
/**
|
/**
|
||||||
@@ -107,6 +111,7 @@ public enum ClientType {
|
|||||||
"19.22.3",
|
"19.22.3",
|
||||||
"com.google.ios.youtube/19.22.3 (iPad7,6; U; CPU iPadOS 17_7_10 like Mac OS X; " + Locale.getDefault() + ")",
|
"com.google.ios.youtube/19.22.3 (iPad7,6; U; CPU iPadOS 17_7_10 like Mac OS X; " + Locale.getDefault() + ")",
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
"iPadOS"
|
"iPadOS"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -180,6 +185,11 @@ public enum ClientType {
|
|||||||
*/
|
*/
|
||||||
public final boolean useAuth;
|
public final boolean useAuth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the client supports multiple audio tracks.
|
||||||
|
*/
|
||||||
|
public final boolean supportsMultiAudioTracks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Friendly name displayed in stats for nerds.
|
* Friendly name displayed in stats for nerds.
|
||||||
*/
|
*/
|
||||||
@@ -200,6 +210,7 @@ public enum ClientType {
|
|||||||
@NonNull String cronetVersion,
|
@NonNull String cronetVersion,
|
||||||
String clientVersion,
|
String clientVersion,
|
||||||
boolean useAuth,
|
boolean useAuth,
|
||||||
|
boolean supportsMultiAudioTracks,
|
||||||
String friendlyName) {
|
String friendlyName) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.clientName = clientName;
|
this.clientName = clientName;
|
||||||
@@ -213,6 +224,7 @@ public enum ClientType {
|
|||||||
this.cronetVersion = cronetVersion;
|
this.cronetVersion = cronetVersion;
|
||||||
this.clientVersion = clientVersion;
|
this.clientVersion = clientVersion;
|
||||||
this.useAuth = useAuth;
|
this.useAuth = useAuth;
|
||||||
|
this.supportsMultiAudioTracks = supportsMultiAudioTracks;
|
||||||
this.friendlyName = friendlyName;
|
this.friendlyName = friendlyName;
|
||||||
|
|
||||||
Locale defaultLocale = Locale.getDefault();
|
Locale defaultLocale = Locale.getDefault();
|
||||||
@@ -238,6 +250,7 @@ public enum ClientType {
|
|||||||
String clientVersion,
|
String clientVersion,
|
||||||
String userAgent,
|
String userAgent,
|
||||||
boolean useAuth,
|
boolean useAuth,
|
||||||
|
boolean supportsMultiAudioTracks,
|
||||||
String friendlyName) {
|
String friendlyName) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.clientName = clientName;
|
this.clientName = clientName;
|
||||||
@@ -248,6 +261,7 @@ public enum ClientType {
|
|||||||
this.clientVersion = clientVersion;
|
this.clientVersion = clientVersion;
|
||||||
this.userAgent = userAgent;
|
this.userAgent = userAgent;
|
||||||
this.useAuth = useAuth;
|
this.useAuth = useAuth;
|
||||||
|
this.supportsMultiAudioTracks = supportsMultiAudioTracks;
|
||||||
this.friendlyName = friendlyName;
|
this.friendlyName = friendlyName;
|
||||||
this.packageName = null;
|
this.packageName = null;
|
||||||
this.androidSdkVersion = null;
|
this.androidSdkVersion = null;
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ public class ForceOriginalAudioPatch {
|
|||||||
/**
|
/**
|
||||||
* Injection point.
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static void setPreferredLanguage() {
|
public static void setEnabled() {
|
||||||
app.revanced.extension.shared.patches.ForceOriginalAudioPatch.setEnabled(
|
app.revanced.extension.shared.patches.ForceOriginalAudioPatch.setEnabled(
|
||||||
Settings.FORCE_ORIGINAL_AUDIO.get(),
|
Settings.FORCE_ORIGINAL_AUDIO.get(),
|
||||||
Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get()
|
Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get()
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ internal fun forceOriginalAudioPatch(
|
|||||||
|
|
||||||
mainActivityOnCreateFingerprint.method.addInstruction(
|
mainActivityOnCreateFingerprint.method.addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static { }, $subclassExtensionClassDescriptor->setPreferredLanguage()V"
|
"invoke-static { }, $subclassExtensionClassDescriptor->setEnabled()V"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Disable feature flag that ignores the default track flag
|
// Disable feature flag that ignores the default track flag
|
||||||
|
|||||||
Reference in New Issue
Block a user