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 8df70412c..14240a767 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 @@ -33,15 +33,6 @@ public enum ClientType { "com.google.android.apps.youtube.unplugged/8.49.0 (Linux; U; Android 14; GB) gzip", "34", "8.49.0", - true), // Requires login. - ANDROID_CREATOR( - 14, - "ANDROID_CREATOR", - "Android", - "11", - "com.google.android.apps.youtube.creator/24.45.100 (Linux; U; Android 11) gzip", - "30", - "24.45.100", true); // Requires login. /** diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/StreamingDataRequest.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/StreamingDataRequest.java index 9020457e1..67f687b79 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/StreamingDataRequest.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/requests/StreamingDataRequest.java @@ -22,6 +22,7 @@ import java.util.concurrent.TimeoutException; import app.revanced.extension.shared.Logger; import app.revanced.extension.shared.Utils; import app.revanced.extension.shared.settings.BaseSettings; +import app.revanced.extension.shared.spoof.AudioStreamLanguage; import app.revanced.extension.shared.spoof.ClientType; /** @@ -36,20 +37,25 @@ import app.revanced.extension.shared.spoof.ClientType; public class StreamingDataRequest { private static final ClientType[] CLIENT_ORDER_TO_USE = ClientType.values(); + private static final String AUTHORIZATION_HEADER = "Authorization"; + private static final String[] REQUEST_HEADER_KEYS = { AUTHORIZATION_HEADER, // Available only to logged-in users. "X-GOOG-API-FORMAT-VERSION", "X-Goog-Visitor-Id" }; + /** * TCP connection and HTTP read timeout. */ private static final int HTTP_TIMEOUT_MILLISECONDS = 10 * 1000; + /** * Any arbitrarily large value, but must be at least twice {@link #HTTP_TIMEOUT_MILLISECONDS} */ private static final int MAX_MILLISECONDS_TO_WAIT_FOR_FETCH = 20 * 1000; + private static final Map cache = Collections.synchronizedMap( new LinkedHashMap<>(100) { /** @@ -68,6 +74,7 @@ public class StreamingDataRequest { }); private final String videoId; + private final Future future; private StreamingDataRequest(String videoId, Map playerHeaders) { @@ -157,13 +164,21 @@ public class StreamingDataRequest { // Show an error if the last client type fails, or if the debug is enabled then show for all attempts. final boolean showErrorToast = (++i == CLIENT_ORDER_TO_USE.length) || debugEnabled; + if (clientType == ClientType.ANDROID_VR_NO_AUTH + && BaseSettings.SPOOF_VIDEO_STREAMS_LANGUAGE.get() == AudioStreamLanguage.DEFAULT) { + // Only use no auth Android VR if a non default audio language is selected. + continue; + } + HttpURLConnection connection = send(clientType, videoId, playerHeaders, showErrorToast); if (connection != null) { try { // gzip encoding doesn't response with content length (-1), // but empty response body does. if (connection.getContentLength() == 0) { - Logger.printDebug(() -> "Received empty response for client: " + clientType); + if (BaseSettings.DEBUG.get()) { + Logger.printException(() -> "Ignoring empty client response: " + clientType); + } } else { try (InputStream inputStream = new BufferedInputStream(connection.getInputStream()); ByteArrayOutputStream baos = new ByteArrayOutputStream()) { diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index 412d7dbb7..97de32355 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -1298,12 +1298,11 @@ Video playback may not work" Turning off this setting may cause video playback issues. Default client Spoofing side effects - "• Kids videos may not play -• Audio track menu is missing + "• Audio track menu is missing • Stable volume is not available • Force original audio is not available" Default audio stream language - App language + Account language Arabic Azerbaijani Bulgarian