From 422d58508ea76d2fbdf62d93646a4650080ff6ff Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Mon, 29 Jun 2026 09:19:43 -0400 Subject: [PATCH] [skip ci] capture response data when id extraction fails --- CHANGELOG.md | 4 +++ .../Services/Innertube/SessionData.bs | 30 +++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15603c9c..262c4b96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +- Nothing worth mentioning yet. + ## [0.47.5] - 2026-06-28 ### Fixed diff --git a/playlet-lib/src/components/Services/Innertube/SessionData.bs b/playlet-lib/src/components/Services/Innertube/SessionData.bs index 45bc10f2..ed5b3536 100644 --- a/playlet-lib/src/components/Services/Innertube/SessionData.bs +++ b/playlet-lib/src/components/Services/Innertube/SessionData.bs @@ -24,15 +24,23 @@ namespace Innertube function RequestTvClientData(cancellation = invalid as object) as object visitorData = "" livingRoomPoTokenId = "" + visitorDataResponse = "" + livingRoomPoTokenIdResponse = "" for attempt = 1 to TV_CLIENT_DATA_MAX_ATTEMPTS text = FetchTvClientPage(cancellation) - if text <> invalid + if not StringUtils.IsNullOrEmpty(text) if StringUtils.IsNullOrEmpty(visitorData) visitorData = ExtractEscapedJsonString(text, "visitorData") + if StringUtils.IsNullOrEmpty(visitorData) + visitorDataResponse = text + end if end if if StringUtils.IsNullOrEmpty(livingRoomPoTokenId) livingRoomPoTokenId = ExtractEscapedJsonString(text, "LIVING_ROOM_PO_TOKEN_ID") + if StringUtils.IsNullOrEmpty(livingRoomPoTokenId) + livingRoomPoTokenIdResponse = text + end if end if if not StringUtils.IsNullOrEmpty(visitorData) and not StringUtils.IsNullOrEmpty(livingRoomPoTokenId) exit for @@ -47,10 +55,10 @@ namespace Innertube end for if StringUtils.IsNullOrEmpty(visitorData) - LogError("Could not extract visitorData from tv client data") + ReportTvClientDataFailure("Could not extract visitorData from tv client data", visitorDataResponse) end if if StringUtils.IsNullOrEmpty(livingRoomPoTokenId) - LogError("Could not extract livingRoomPoTokenId from tv client data") + ReportTvClientDataFailure("Could not extract livingRoomPoTokenId from tv client data", livingRoomPoTokenIdResponse) end if if StringUtils.IsNullOrEmpty(visitorData) and StringUtils.IsNullOrEmpty(livingRoomPoTokenId) return invalid @@ -63,6 +71,22 @@ namespace Innertube } end function + function ReportTvClientDataFailure(message as string, responseText as dynamic) as void + LogErrorNoTelemetry(message) + event = { + level: "error" + message: message + } + if not StringUtils.IsNullOrEmpty(responseText) + event.attachments = [{ + filename: "response.html" + content_type: "text/html" + data: responseText + }] + end if + LogTelemetryEvent(event) + end function + function FetchTvClientPage(cancellation as object) as dynamic request = HttpClient.Get("https://www.youtube.com/tv") headers = Innertube.CreateHeaders(Innertube.ClientType.Tv)