Skip to content

Commit 5f23bfe

Browse files
feat(Spoof video streams): Add experimental "Android No SDK" client type
1 parent 2cf8f0e commit 5f23bfe

File tree

5 files changed

+50
-10
lines changed

5 files changed

+50
-10
lines changed

extensions/music/src/main/java/app/revanced/extension/music/patches/spoof/SpoofVideoStreamsPatch.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package app.revanced.extension.music.patches.spoof;
22

33
import static app.revanced.extension.music.settings.Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE;
4+
import static app.revanced.extension.shared.spoof.ClientType.ANDROID_NO_SDK;
45
import static app.revanced.extension.shared.spoof.ClientType.ANDROID_VR_1_43_32;
56
import static app.revanced.extension.shared.spoof.ClientType.ANDROID_VR_1_61_48;
67
import static app.revanced.extension.shared.spoof.ClientType.VISIONOS;
@@ -18,8 +19,9 @@ public class SpoofVideoStreamsPatch {
1819
public static void setClientOrderToUse() {
1920
List<ClientType> availableClients = List.of(
2021
ANDROID_VR_1_43_32,
21-
ANDROID_VR_1_61_48,
22-
VISIONOS
22+
ANDROID_NO_SDK,
23+
VISIONOS,
24+
ANDROID_VR_1_61_48
2325
);
2426

2527
app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.setClientsToUse(

extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/ClientType.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,33 @@ public enum ClientType {
5454
ANDROID_VR_1_61_48.supportsMultiAudioTracks,
5555
"Android VR 1.43"
5656
),
57+
/**
58+
* Video not playable: Paid / Movie / Private / Age-restricted.
59+
* Note: The 'Authorization' key must be excluded from the header.
60+
*
61+
* According to TeamNewPipe in 2022, if the 'androidSdkVersion' field is missing,
62+
* the GVS did not return a valid response:
63+
* [NewPipe#8713 (comment)](https://github.com/TeamNewPipe/NewPipe/issues/8713#issuecomment-1207443550).
64+
*
65+
* According to the latest commit in yt-dlp, the GVS returns a valid response
66+
* even if the 'androidSdkVersion' field is missing:
67+
* [yt-dlp#14693](https://github.com/yt-dlp/yt-dlp/pull/14693).
68+
*
69+
* For some reason, PoToken is not required.
70+
*/
71+
ANDROID_NO_SDK(
72+
3,
73+
"ANDROID",
74+
"",
75+
"",
76+
"",
77+
Build.VERSION.RELEASE,
78+
"20.05.46",
79+
"com.google.android.youtube/20.05.46 (Linux; U; Android " + Build.VERSION.RELEASE + ") gzip",
80+
false,
81+
true,
82+
"Android No SDK"
83+
),
5784
/**
5885
* Cannot play livestreams and lacks HDR, but can play videos with music and labeled "for children".
5986
* <a href="https://dumps.tadiphone.dev/dumps/google/barbet">Google Pixel 9 Pro Fold</a>

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/spoof/SpoofVideoStreamsPatch.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package app.revanced.extension.youtube.patches.spoof;
22

33
import static app.revanced.extension.shared.spoof.ClientType.ANDROID_CREATOR;
4+
import static app.revanced.extension.shared.spoof.ClientType.ANDROID_NO_SDK;
45
import static app.revanced.extension.shared.spoof.ClientType.ANDROID_VR_1_43_32;
56
import static app.revanced.extension.shared.spoof.ClientType.ANDROID_VR_1_61_48;
67
import static app.revanced.extension.shared.spoof.ClientType.IPADOS;
@@ -41,6 +42,7 @@ public static void setClientOrderToUse() {
4142
VISIONOS,
4243
ANDROID_CREATOR,
4344
ANDROID_VR_1_43_32,
45+
ANDROID_NO_SDK,
4446
IPADOS);
4547

4648
app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.setClientsToUse(

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/preference/SpoofStreamingDataSideEffectsPreference.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,34 @@ private void updateUI() {
8080
Logger.printDebug(() -> "Updating spoof stream side effects preference");
8181
setEnabled(BaseSettings.SPOOF_VIDEO_STREAMS.get());
8282

83-
String summary = str("revanced_spoof_video_streams_about_no_audio_tracks");
83+
String summary = "";
8484

8585
switch (clientType) {
8686
case ANDROID_CREATOR ->
87-
summary += '\n' + str("revanced_spoof_video_streams_about_no_stable_volume")
88-
+ '\n' + str("revanced_spoof_video_streams_about_no_av1")
89-
+ '\n' + str("revanced_spoof_video_streams_about_no_force_original_audio");
87+
summary = str("revanced_spoof_video_streams_about_no_audio_tracks")
88+
+ '\n' + str("revanced_spoof_video_streams_about_no_stable_volume")
89+
+ '\n' + str("revanced_spoof_video_streams_about_no_av1")
90+
+ '\n' + str("revanced_spoof_video_streams_about_no_force_original_audio");
9091
// VR 1.61 is not exposed in the UI and should never be reached here.
9192
case ANDROID_VR_1_43_32, ANDROID_VR_1_61_48 ->
92-
summary += '\n' + str("revanced_spoof_video_streams_about_no_stable_volume");
93+
summary = str("revanced_spoof_video_streams_about_no_audio_tracks")
94+
+ '\n' + str("revanced_spoof_video_streams_about_no_stable_volume");
95+
case ANDROID_NO_SDK ->
96+
summary = str("revanced_spoof_video_streams_about_playback_failure");
9397
case IPADOS ->
9498
summary = str("revanced_spoof_video_streams_about_playback_failure")
9599
+ '\n' + str("revanced_spoof_video_streams_about_no_av1");
96100
case VISIONOS ->
97101
summary = str("revanced_spoof_video_streams_about_experimental")
98-
+ '\n' + summary
102+
+ '\n' + str("revanced_spoof_video_streams_about_no_audio_tracks")
99103
+ '\n' + str("revanced_spoof_video_streams_about_no_av1");
104+
default -> Logger.printException(() -> "Unknown client: " + clientType);
100105
}
101106

102107
// Only iPadOS can play children videos in incognito, but it commonly fails at 1 minute
103-
// or doesn't even start playback at all. List the side effect for other clients
108+
// or doesn't start playback at all. List the side effect for other clients
104109
// since they will fall over to iPadOS.
105-
if (clientType != ClientType.IPADOS) {
110+
if (clientType != ClientType.IPADOS && clientType != ClientType.ANDROID_NO_SDK) {
106111
summary += '\n' + str("revanced_spoof_video_streams_about_kids_videos");
107112
}
108113

patches/src/main/resources/addresources/values/arrays.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,12 @@
185185
<string-array name="revanced_spoof_video_streams_client_type_entries">
186186
<item>Android VR</item>
187187
<item>visionOS</item>
188+
<item>Android No SDK</item>
188189
</string-array>
189190
<string-array name="revanced_spoof_video_streams_client_type_entry_values">
190191
<item>ANDROID_VR_1_43_32</item>
191192
<item>VISIONOS</item>
193+
<item>ANDROID_NO_SDK</item>
192194
</string-array>
193195
</patch>
194196
</app>
@@ -227,12 +229,14 @@
227229
<string-array name="revanced_spoof_video_streams_client_type_entries">
228230
<item>Android VR</item>
229231
<item>Android Studio</item>
232+
<item>Android No SDK</item>
230233
<item>visionOS</item>
231234
<item>iPadOS</item>
232235
</string-array>
233236
<string-array name="revanced_spoof_video_streams_client_type_entry_values">
234237
<item>ANDROID_VR_1_43_32</item>
235238
<item>ANDROID_CREATOR</item>
239+
<item>ANDROID_NO_SDK</item>
236240
<item>VISIONOS</item>
237241
<item>IPADOS</item>
238242
</string-array>

0 commit comments

Comments
 (0)