mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-27 11:55:54 +01:00
fix(YouTube - Spoof video stream): Remove UI client type setting. Allow setting default audio language. (#4184)
This commit is contained in:
parent
7179f7e90d
commit
99f3f29c64
@ -5,7 +5,6 @@ import static java.lang.Boolean.TRUE;
|
|||||||
import static app.revanced.extension.shared.settings.Setting.parent;
|
import static app.revanced.extension.shared.settings.Setting.parent;
|
||||||
|
|
||||||
import app.revanced.extension.shared.spoof.AudioStreamLanguage;
|
import app.revanced.extension.shared.spoof.AudioStreamLanguage;
|
||||||
import app.revanced.extension.shared.spoof.ClientType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings shared across multiple apps.
|
* Settings shared across multiple apps.
|
||||||
@ -22,6 +21,4 @@ public class BaseSettings {
|
|||||||
|
|
||||||
public static final BooleanSetting SPOOF_VIDEO_STREAMS = new BooleanSetting("revanced_spoof_video_streams", TRUE, true, "revanced_spoof_video_streams_user_dialog_message");
|
public static final BooleanSetting SPOOF_VIDEO_STREAMS = new BooleanSetting("revanced_spoof_video_streams", TRUE, true, "revanced_spoof_video_streams_user_dialog_message");
|
||||||
public static final EnumSetting<AudioStreamLanguage> SPOOF_VIDEO_STREAMS_LANGUAGE = new EnumSetting<>("revanced_spoof_video_streams_language", AudioStreamLanguage.DEFAULT, parent(SPOOF_VIDEO_STREAMS));
|
public static final EnumSetting<AudioStreamLanguage> SPOOF_VIDEO_STREAMS_LANGUAGE = new EnumSetting<>("revanced_spoof_video_streams_language", AudioStreamLanguage.DEFAULT, parent(SPOOF_VIDEO_STREAMS));
|
||||||
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_VR, true, parent(SPOOF_VIDEO_STREAMS));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,33 +6,43 @@ import androidx.annotation.Nullable;
|
|||||||
|
|
||||||
public enum ClientType {
|
public enum ClientType {
|
||||||
// https://dumps.tadiphone.dev/dumps/oculus/eureka
|
// https://dumps.tadiphone.dev/dumps/oculus/eureka
|
||||||
ANDROID_VR(
|
ANDROID_VR_NO_AUTH( // Must be first so a default audio language can be set.
|
||||||
28,
|
28,
|
||||||
|
"ANDROID_VR",
|
||||||
"Quest 3",
|
"Quest 3",
|
||||||
"12",
|
"12",
|
||||||
"com.google.android.apps.youtube.vr.oculus/1.56.21 (Linux; U; Android 12; GB) gzip",
|
"com.google.android.apps.youtube.vr.oculus/1.56.21 (Linux; U; Android 12; GB) gzip",
|
||||||
"32", // Android 12.1
|
"32", // Android 12.1
|
||||||
"1.56.21",
|
"1.56.21",
|
||||||
true
|
false),
|
||||||
),
|
// Fall over to authenticated ('hl' is ignored and audio is same as language set in users Google account).
|
||||||
|
ANDROID_VR(
|
||||||
|
ANDROID_VR_NO_AUTH.id,
|
||||||
|
ANDROID_VR_NO_AUTH.clientName,
|
||||||
|
ANDROID_VR_NO_AUTH.deviceModel,
|
||||||
|
ANDROID_VR_NO_AUTH.osVersion,
|
||||||
|
ANDROID_VR_NO_AUTH.userAgent,
|
||||||
|
ANDROID_VR_NO_AUTH.androidSdkVersion,
|
||||||
|
ANDROID_VR_NO_AUTH.clientVersion,
|
||||||
|
true),
|
||||||
ANDROID_UNPLUGGED(
|
ANDROID_UNPLUGGED(
|
||||||
29,
|
29,
|
||||||
|
"ANDROID_UNPLUGGED",
|
||||||
"Google TV Streamer",
|
"Google TV Streamer",
|
||||||
"14",
|
"14",
|
||||||
"com.google.android.apps.youtube.unplugged/8.49.0 (Linux; U; Android 14; GB) gzip",
|
"com.google.android.apps.youtube.unplugged/8.49.0 (Linux; U; Android 14; GB) gzip",
|
||||||
"34",
|
"34",
|
||||||
"8.49.0",
|
"8.49.0",
|
||||||
true
|
true), // Requires login.
|
||||||
),
|
|
||||||
ANDROID_CREATOR(
|
ANDROID_CREATOR(
|
||||||
14,
|
14,
|
||||||
|
"ANDROID_CREATOR",
|
||||||
"Android",
|
"Android",
|
||||||
"11",
|
"11",
|
||||||
"com.google.android.apps.youtube.creator/24.45.100 (Linux; U; Android 11) gzip",
|
"com.google.android.apps.youtube.creator/24.45.100 (Linux; U; Android 11) gzip",
|
||||||
"30",
|
"30",
|
||||||
"24.45.100",
|
"24.45.100",
|
||||||
true
|
true); // Requires login.
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* YouTube
|
* YouTube
|
||||||
@ -75,6 +85,7 @@ public enum ClientType {
|
|||||||
public final boolean canLogin;
|
public final boolean canLogin;
|
||||||
|
|
||||||
ClientType(int id,
|
ClientType(int id,
|
||||||
|
String clientName,
|
||||||
String deviceModel,
|
String deviceModel,
|
||||||
String osVersion,
|
String osVersion,
|
||||||
String userAgent,
|
String userAgent,
|
||||||
@ -82,7 +93,7 @@ public enum ClientType {
|
|||||||
String clientVersion,
|
String clientVersion,
|
||||||
boolean canLogin) {
|
boolean canLogin) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.clientName = name();
|
this.clientName = clientName;
|
||||||
this.deviceModel = deviceModel;
|
this.deviceModel = deviceModel;
|
||||||
this.osVersion = osVersion;
|
this.osVersion = osVersion;
|
||||||
this.userAgent = userAgent;
|
this.userAgent = userAgent;
|
||||||
|
@ -10,7 +10,6 @@ import java.util.Map;
|
|||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.Logger;
|
||||||
import app.revanced.extension.shared.Utils;
|
import app.revanced.extension.shared.Utils;
|
||||||
import app.revanced.extension.shared.settings.BaseSettings;
|
import app.revanced.extension.shared.settings.BaseSettings;
|
||||||
import app.revanced.extension.shared.settings.EnumSetting;
|
|
||||||
import app.revanced.extension.shared.settings.Setting;
|
import app.revanced.extension.shared.settings.Setting;
|
||||||
import app.revanced.extension.shared.spoof.requests.StreamingDataRequest;
|
import app.revanced.extension.shared.spoof.requests.StreamingDataRequest;
|
||||||
|
|
||||||
@ -35,8 +34,7 @@ public class SpoofVideoStreamsPatch {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
if (SpoofVideoStreamsPatch.isPatchIncluded()) {
|
if (SpoofVideoStreamsPatch.isPatchIncluded()) {
|
||||||
EnumSetting<ClientType> setting = BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE;
|
return !BaseSettings.SPOOF_VIDEO_STREAMS.get();
|
||||||
return !setting.isAvailable() || setting.get().androidSdkVersion == null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,7 +35,7 @@ import app.revanced.extension.shared.spoof.ClientType;
|
|||||||
*/
|
*/
|
||||||
public class StreamingDataRequest {
|
public class StreamingDataRequest {
|
||||||
|
|
||||||
private static final ClientType[] CLIENT_ORDER_TO_USE;
|
private static final ClientType[] CLIENT_ORDER_TO_USE = ClientType.values();
|
||||||
private static final String AUTHORIZATION_HEADER = "Authorization";
|
private static final String AUTHORIZATION_HEADER = "Authorization";
|
||||||
private static final String[] REQUEST_HEADER_KEYS = {
|
private static final String[] REQUEST_HEADER_KEYS = {
|
||||||
AUTHORIZATION_HEADER, // Available only to logged-in users.
|
AUTHORIZATION_HEADER, // Available only to logged-in users.
|
||||||
@ -67,21 +67,6 @@ public class StreamingDataRequest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static {
|
|
||||||
ClientType[] allClientTypes = ClientType.values();
|
|
||||||
ClientType preferredClient = BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get();
|
|
||||||
|
|
||||||
CLIENT_ORDER_TO_USE = new ClientType[allClientTypes.length];
|
|
||||||
CLIENT_ORDER_TO_USE[0] = preferredClient;
|
|
||||||
|
|
||||||
int i = 1;
|
|
||||||
for (ClientType c : allClientTypes) {
|
|
||||||
if (c != preferredClient) {
|
|
||||||
CLIENT_ORDER_TO_USE[i++] = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final String videoId;
|
private final String videoId;
|
||||||
private final Future<ByteBuffer> future;
|
private final Future<ByteBuffer> future;
|
||||||
|
|
||||||
@ -178,7 +163,7 @@ public class StreamingDataRequest {
|
|||||||
// gzip encoding doesn't response with content length (-1),
|
// gzip encoding doesn't response with content length (-1),
|
||||||
// but empty response body does.
|
// but empty response body does.
|
||||||
if (connection.getContentLength() == 0) {
|
if (connection.getContentLength() == 0) {
|
||||||
Logger.printDebug(() -> "Received empty response for video: " + videoId);
|
Logger.printDebug(() -> "Received empty response for client: " + clientType);
|
||||||
} else {
|
} else {
|
||||||
try (InputStream inputStream = new BufferedInputStream(connection.getInputStream());
|
try (InputStream inputStream = new BufferedInputStream(connection.getInputStream());
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
||||||
|
@ -36,15 +36,11 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch({
|
|||||||
sorting = PreferenceScreenPreference.Sorting.UNSORTED,
|
sorting = PreferenceScreenPreference.Sorting.UNSORTED,
|
||||||
preferences = setOf(
|
preferences = setOf(
|
||||||
SwitchPreference("revanced_spoof_video_streams"),
|
SwitchPreference("revanced_spoof_video_streams"),
|
||||||
ListPreference(
|
|
||||||
"revanced_spoof_video_streams_client_type",
|
|
||||||
summaryKey = null,
|
|
||||||
),
|
|
||||||
ListPreference(
|
ListPreference(
|
||||||
"revanced_spoof_video_streams_language",
|
"revanced_spoof_video_streams_language",
|
||||||
summaryKey = null
|
summaryKey = null
|
||||||
),
|
),
|
||||||
NonInteractivePreference("revanced_spoof_video_streams_about_android")
|
NonInteractivePreference("revanced_spoof_video_streams_about")
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -1,18 +1,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<app id="youtube">
|
<app id="youtube">
|
||||||
<patch id="misc.fix.playback.spoofVideoStreamsPatch">
|
<patch id="misc.fix.playback.spoofVideoStreamsPatch">
|
||||||
<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>Android TV</item>
|
|
||||||
<item>Android Creator</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="revanced_spoof_video_streams_client_type_entry_values">
|
|
||||||
<!-- Enum names from extension -->
|
|
||||||
<item>ANDROID_VR</item>
|
|
||||||
<item>ANDROID_UNPLUGGED</item>
|
|
||||||
<item>ANDROID_CREATOR</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="revanced_spoof_video_streams_language_entries">
|
<string-array name="revanced_spoof_video_streams_language_entries">
|
||||||
<item>@string/revanced_spoof_video_streams_language_DEFAULT</item>
|
<item>@string/revanced_spoof_video_streams_language_DEFAULT</item>
|
||||||
<item>@string/revanced_spoof_video_streams_language_AR</item>
|
<item>@string/revanced_spoof_video_streams_language_AR</item>
|
||||||
|
@ -1297,8 +1297,8 @@ Enabling this can unlock higher video qualities"</string>
|
|||||||
Video playback may not work"</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_user_dialog_message">Turning off this setting may cause video playback issues.</string>
|
||||||
<string name="revanced_spoof_video_streams_client_type_title">Default client</string>
|
<string name="revanced_spoof_video_streams_client_type_title">Default client</string>
|
||||||
<string name="revanced_spoof_video_streams_about_android_title">Android spoofing side effects</string>
|
<string name="revanced_spoof_video_streams_about_title">Spoofing side effects</string>
|
||||||
<string name="revanced_spoof_video_streams_about_android_summary">"• Kids videos may not play
|
<string name="revanced_spoof_video_streams_about_summary">"• Kids videos may not play
|
||||||
• Audio track menu is missing
|
• Audio track menu is missing
|
||||||
• Stable volume is not available
|
• Stable volume is not available
|
||||||
• Force original audio is not available"</string>
|
• Force original audio is not available"</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user