fix(YouTube - Spoof streaming data): Mark login-required client

This commit is contained in:
inotia00 2025-01-03 21:44:30 +09:00
parent 8ab67bc6ef
commit c6ad8331bc
4 changed files with 29 additions and 10 deletions

View File

@ -207,8 +207,14 @@ object AppClient {
val clientVersion: String,
/**
* If the client can access the API logged in.
* If false, 'Authorization' must not be included.
*/
val canLogin: Boolean = true,
val supportsCookies: Boolean = true,
/**
* If the client can only access the API logged in.
* If true, 'Authorization' must be included.
*/
val requireAuth: Boolean = false,
/**
* Whether a poToken is required to get playback for more than 1 minute.
*/
@ -234,6 +240,7 @@ object AppClient {
userAgent = USER_AGENT_ANDROID_UNPLUGGED,
androidSdkVersion = ANDROID_SDK_VERSION_ANDROID_UNPLUGGED,
clientVersion = CLIENT_VERSION_ANDROID_UNPLUGGED,
requireAuth = true,
friendlyName = "Android TV"
),
IOS_UNPLUGGED(
@ -242,6 +249,7 @@ object AppClient {
osVersion = OS_VERSION_IOS,
userAgent = USER_AGENT_IOS_UNPLUGGED,
clientVersion = CLIENT_VERSION_IOS_UNPLUGGED,
requireAuth = true,
friendlyName = if (forceAVC())
"iOS TV Force AVC"
else
@ -253,7 +261,7 @@ object AppClient {
osVersion = OS_VERSION_IOS,
userAgent = USER_AGENT_IOS,
clientVersion = CLIENT_VERSION_IOS,
canLogin = false,
supportsCookies = false,
requirePoToken = true,
friendlyName = if (forceAVC())
"iOS Force AVC"
@ -265,6 +273,7 @@ object AppClient {
userAgent = USER_AGENT_ANDROID_MUSIC,
androidSdkVersion = ANDROID_SDK_VERSION_ANDROID_MUSIC,
clientVersion = CLIENT_VERSION_ANDROID_MUSIC,
requireAuth = true,
friendlyName = "Android Music"
);

View File

@ -71,7 +71,7 @@ object PlayerRoutes {
client.put("deviceMake", "Apple")
client.put("osName", "iOS")
}
if (!clientType.canLogin) {
if (!clientType.supportsCookies) {
client.put("hl", LOCALE_LANGUAGE)
}

View File

@ -194,7 +194,7 @@ class StreamingDataRequest private constructor(
var value = playerHeaders[key]
if (value != null) {
if (key == AUTHORIZATION_HEADER) {
if (!clientType.canLogin) {
if (!clientType.supportsCookies) {
Logger.printDebug { "Not including request header: $key" }
continue
}
@ -260,6 +260,11 @@ class StreamingDataRequest private constructor(
// Retry with different client if empty response body is received.
for (clientType in CLIENT_ORDER_TO_USE) {
if (clientType.requireAuth &&
playerHeaders[AUTHORIZATION_HEADER] == null) {
Logger.printDebug { "Skipped login-required client (incognito mode or not logged in)\nClient: $clientType\nVideo: $videoId" }
continue
}
send(
clientType,
videoId,

View File

@ -1907,16 +1907,21 @@ Tap the continue button and allow optimization changes."</string>
<string name="revanced_spoof_streaming_data_summary_off">"Streaming data is not spoofed. Video playback may not work."</string>
<string name="revanced_spoof_streaming_data_user_dialog_message">Turning off this setting may cause video playback issues.</string>
<string name="revanced_spoof_streaming_data_type_title">Default client</string>
<string name="revanced_spoof_streaming_data_type_entry_android_unplugged">Android TV</string>
<string name="revanced_spoof_streaming_data_type_entry_android_unplugged">"Android TV
<small>(Login required)</small>"</string>
<string name="revanced_spoof_streaming_data_type_entry_android_vr">Android VR</string>
<string name="revanced_spoof_streaming_data_type_entry_ios">iOS</string>
<string name="revanced_spoof_streaming_data_type_entry_ios_unplugged">iOS TV</string>
<string name="revanced_spoof_streaming_data_type_entry_ios">"iOS
<small>(PoToken required)</small>"</string>
<string name="revanced_spoof_streaming_data_type_entry_ios_unplugged">"iOS TV
<small>(Login required)</small>"</string>
<string name="revanced_spoof_streaming_data_side_effects_title">Spoofing side effects</string>
<string name="revanced_spoof_streaming_data_side_effects_android">"• Audio track menu is missing.
• Stable volume is not available.
• Disable forced auto audio tracks is not available."</string>
<string name="revanced_spoof_streaming_data_side_effects_ios">• There may be playback issues (Deprecated).</string>
<string name="revanced_spoof_streaming_data_side_effects_ios_unplugged">• Movies or paid videos may not play.</string>
• Disable forced auto audio tracks is not available.
• Kids videos may not play when logged out or in incognito mode."</string>
<string name="revanced_spoof_streaming_data_side_effects_ios">• There may be playback issues (PoToken required).</string>
<string name="revanced_spoof_streaming_data_side_effects_ios_unplugged">"• Movies or paid videos may not play.
• Kids videos may not play when logged out or in incognito mode."</string>
<string name="revanced_spoof_streaming_data_ios_force_avc_title">Force iOS AVC (H.264)</string>
<string name="revanced_spoof_streaming_data_ios_force_avc_summary_on">Video codec is forced to AVC (H.264).</string>
<string name="revanced_spoof_streaming_data_ios_force_avc_summary_off">Video codec is determined automatically.</string>