Modern Apps git

← Modern-Apps.git

youpipe: align YouTube extractor with PipePipe (android_vr player-request body: add userAgent+timeZone, drop platform)

Commit
ea31df88a754d62afbc2f8b00ce0398ac4b63ded
Author
vayun-mathur <[email protected]>
When
2026-08-16 16:16 UTC (3 months ago)
Parents
29c2660

Diff

youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/InnertubeClientRequestInfo.kt
diff --git a/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/InnertubeClientRequestInfo.kt b/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/InnertubeClientRequestInfo.ktindex 4e7c438e6d..a0afdfabfb 100644--- a/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/InnertubeClientRequestInfo.kt+++ b/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/InnertubeClientRequestInfo.kt@@ -27,7 +27,13 @@ class InnertubeClientRequestInfo private constructor(         var clientScreen: String?,         @JvmField         @field:Nullable-        var visitorData: String?+        var visitorData: String?,+        @JvmField+        @field:Nullable+        var userAgent: String?,+        @JvmField+        @field:Nullable+        var timeZone: String?     ) {         companion object {             internal fun create(@@ -35,8 +41,12 @@ class InnertubeClientRequestInfo private constructor(                 clientVersion: String,                 clientId: String,                 clientScreen: String?,-                visitorData: String?-            ): ClientInfo = ClientInfo(clientName, clientVersion, clientId, clientScreen, visitorData)+                visitorData: String?,+                userAgent: String? = null,+                timeZone: String? = null+            ): ClientInfo = ClientInfo(+                clientName, clientVersion, clientId, clientScreen, visitorData, userAgent, timeZone+            )         }     } @@ -140,16 +150,20 @@ class InnertubeClientRequestInfo private constructor(          @JvmStatic         fun ofAndroidVrClient(): InnertubeClientRequestInfo {+            // Mirrors PipePipe's android_vr player request context.client: it carries the client+            // userAgent and timeZone=UTC, and does NOT send a platform field.             return InnertubeClientRequestInfo(                 ClientInfo.create(                     ClientsConstants.ANDROID_VR_CLIENT_NAME,                     ClientsConstants.ANDROID_VR_CLIENT_VERSION,                     ClientsConstants.ANDROID_VR_CLIENT_ID,                     null,-                    null+                    null,+                    ClientsConstants.ANDROID_VR_USER_AGENT,+                    "UTC"                 ),                 DeviceInfo.create(-                    ClientsConstants.MOBILE_CLIENT_PLATFORM,+                    null,                     ClientsConstants.ANDROID_VR_DEVICE_MAKE,                     ClientsConstants.ANDROID_VR_DEVICE_MODEL,                     ClientsConstants.ANDROID_VR_OS_NAME,
youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.kt
diff --git a/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.kt b/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.ktindex c9f709770a..74b848f742 100644--- a/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.kt+++ b/youpipe/extractor/src/main/kotlin/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.kt@@ -1315,6 +1315,10 @@ object YoutubeParsingHelper {                     if (osVersion != null) put("osVersion", osVersion)                     val sdk = innertubeClientRequestInfo.deviceInfo.androidSdkVersion                     if (sdk > 0) put("androidSdkVersion", sdk)+                    val userAgent = innertubeClientRequestInfo.clientInfo.userAgent+                    if (userAgent != null) put("userAgent", userAgent)+                    val timeZone = innertubeClientRequestInfo.clientInfo.timeZone+                    if (timeZone != null) put("timeZone", timeZone)                     put("hl", localization.getLocalizationCode())                     put("gl", contentCountry.countryCode)                     put("utcOffsetMinutes", 0)