Skip to content

Commit 839a404

Browse files
fix(YouTube - Spoof video streams): Resolve playback of age restricted videos (ReVanced#4096)
1 parent 0501ba6 commit 839a404

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

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

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ public enum ClientType {
1010
// Specific purpose for age restricted, or private videos, because the iOS client is not logged in.
1111
// https://dumps.tadiphone.dev/dumps/oculus/eureka
1212
ANDROID_VR(28,
13+
"ANDROID_VR",
1314
"Quest 3",
1415
"12",
1516
"com.google.android.apps.youtube.vr.oculus/1.56.21 (Linux; U; Android 12; GB) gzip",
1617
"32", // Android 12.1
1718
"1.56.21",
18-
true
19-
),
19+
true,
20+
true),
2021
// Specific for kids videos.
2122
IOS(5,
23+
"IOS",
2224
forceAVC()
2325
? "iPhone12,5" // 11 Pro Max (last device with iOS 13)
2426
: "iPhone16,2", // 15 Pro Max
@@ -37,8 +39,22 @@ public enum ClientType {
3739
// but 17.40 is the last version that supports iOS 13.
3840
? "17.40.5"
3941
: "19.47.7",
40-
false
41-
);
42+
false,
43+
true),
44+
/**
45+
* Android VR with no language code.
46+
* Used for age restricted videos and YouTube Music to disable stable volume.
47+
*/
48+
ANDROID_VR_NO_HL(
49+
ANDROID_VR.id,
50+
ANDROID_VR.clientName,
51+
ANDROID_VR.deviceModel,
52+
ANDROID_VR.osVersion,
53+
ANDROID_VR.userAgent,
54+
ANDROID_VR.androidSdkVersion,
55+
ANDROID_VR.clientVersion,
56+
ANDROID_VR.canLogin,
57+
false);
4258

4359
private static boolean forceAVC() {
4460
return BaseSettings.SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC.get();
@@ -50,6 +66,8 @@ private static boolean forceAVC() {
5066
*/
5167
public final int id;
5268

69+
public final String clientName;
70+
5371
/**
5472
* Device model, equivalent to {@link Build#MODEL} (System property: ro.product.model)
5573
*/
@@ -82,20 +100,28 @@ private static boolean forceAVC() {
82100
*/
83101
public final boolean canLogin;
84102

103+
/**
104+
* If a language code should be used.
105+
*/
106+
public final boolean useLanguageCode;
107+
85108
ClientType(int id,
109+
String clientName,
86110
String deviceModel,
87111
String osVersion,
88112
String userAgent,
89113
@Nullable String androidSdkVersion,
90114
String clientVersion,
91-
boolean canLogin
92-
) {
115+
boolean canLogin,
116+
boolean useLanguageCode) {
93117
this.id = id;
118+
this.clientName = clientName;
94119
this.deviceModel = deviceModel;
95120
this.osVersion = osVersion;
96121
this.userAgent = userAgent;
97122
this.androidSdkVersion = androidSdkVersion;
98123
this.clientVersion = clientVersion;
99124
this.canLogin = canLogin;
125+
this.useLanguageCode = useLanguageCode;
100126
}
101127
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ static String createInnertubeBody(ClientType clientType) {
3535
JSONObject context = new JSONObject();
3636

3737
JSONObject client = new JSONObject();
38-
client.put("hl", BaseSettings.SPOOF_VIDEO_STREAMS_LANGUAGE.get().getIso639_1());
39-
client.put("clientName", clientType.name());
38+
if (clientType.useLanguageCode) {
39+
client.put("hl", BaseSettings.SPOOF_VIDEO_STREAMS_LANGUAGE.get().getIso639_1());
40+
}
41+
client.put("clientName", clientType.clientName);
4042
client.put("clientVersion", clientType.clientVersion);
4143
client.put("deviceModel", clientType.deviceModel);
4244
client.put("osVersion", clientType.osVersion);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,9 +1229,9 @@ This is because Crowdin requires temporarily flattening this file and removing t
12291229
<string name="revanced_spoof_video_streams_ios_force_avc_summary_off">Video codec is determined automatically</string>
12301230
<string name="revanced_spoof_video_streams_ios_force_avc_user_dialog_message">Enabling this might improve battery life and fix playback stuttering.\n\nAVC has a maximum resolution of 1080p, Opus audio codec is not available, and video playback will use more internet data than VP9 or AV1.</string>
12311231
<string name="revanced_spoof_video_streams_about_ios_title">iOS spoofing side effects</string>
1232-
<string name="revanced_spoof_video_streams_about_ios_summary">• Private kids videos may not play\n• Age restricted videos may not play\n• Livestreams start from the beginning\n• Videos end 1 second early</string>
1232+
<string name="revanced_spoof_video_streams_about_ios_summary">• Private kids videos may not play\n• Livestreams start from the beginning\n• Videos end 1 second early</string>
12331233
<string name="revanced_spoof_video_streams_about_android_vr_title">Android VR spoofing side effects</string>
1234-
<string name="revanced_spoof_video_streams_about_android_vr_summary">• Kids videos may not play\n• Age restricted videos may not play\n• Livestreams start from the beginning\n• Videos end 1 second early</string>
1234+
<string name="revanced_spoof_video_streams_about_android_vr_summary">• Kids videos may not play\n• Livestreams start from the beginning\n• Videos end 1 second early</string>
12351235
<string name="revanced_spoof_video_streams_language_title">Default audio stream language</string>
12361236
<string name="revanced_spoof_video_streams_language_DEFAULT">App language</string>
12371237
<string name="revanced_spoof_video_streams_language_AR">Arabic</string>

0 commit comments

Comments
 (0)