[skip ci] capture response data when id extraction fails
This commit is contained in:
1 parent
430fef1585
commit
422d58508e
2 files changed
+31
-3
No files matched your search
@@ -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/),
|
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).
|
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
|
## [0.47.5] - 2026-06-28
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -24,15 +24,23 @@ namespace Innertube
|
|||||||
function RequestTvClientData(cancellation = invalid as object) as object
|
function RequestTvClientData(cancellation = invalid as object) as object
|
||||||
visitorData = ""
|
visitorData = ""
|
||||||
livingRoomPoTokenId = ""
|
livingRoomPoTokenId = ""
|
||||||
|
visitorDataResponse = ""
|
||||||
|
livingRoomPoTokenIdResponse = ""
|
||||||
|
|
||||||
for attempt = 1 to TV_CLIENT_DATA_MAX_ATTEMPTS
|
for attempt = 1 to TV_CLIENT_DATA_MAX_ATTEMPTS
|
||||||
text = FetchTvClientPage(cancellation)
|
text = FetchTvClientPage(cancellation)
|
||||||
if text <> invalid
|
if not StringUtils.IsNullOrEmpty(text)
|
||||||
if StringUtils.IsNullOrEmpty(visitorData)
|
if StringUtils.IsNullOrEmpty(visitorData)
|
||||||
visitorData = ExtractEscapedJsonString(text, "visitorData")
|
visitorData = ExtractEscapedJsonString(text, "visitorData")
|
||||||
|
if StringUtils.IsNullOrEmpty(visitorData)
|
||||||
|
visitorDataResponse = text
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
if StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
if StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
||||||
livingRoomPoTokenId = ExtractEscapedJsonString(text, "LIVING_ROOM_PO_TOKEN_ID")
|
livingRoomPoTokenId = ExtractEscapedJsonString(text, "LIVING_ROOM_PO_TOKEN_ID")
|
||||||
|
if StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
||||||
|
livingRoomPoTokenIdResponse = text
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
if not StringUtils.IsNullOrEmpty(visitorData) and not StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
if not StringUtils.IsNullOrEmpty(visitorData) and not StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
||||||
exit for
|
exit for
|
||||||
@@ -47,10 +55,10 @@ namespace Innertube
|
|||||||
end for
|
end for
|
||||||
|
|
||||||
if StringUtils.IsNullOrEmpty(visitorData)
|
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
|
end if
|
||||||
if StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
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
|
end if
|
||||||
if StringUtils.IsNullOrEmpty(visitorData) and StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
if StringUtils.IsNullOrEmpty(visitorData) and StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
||||||
return invalid
|
return invalid
|
||||||
@@ -63,6 +71,22 @@ namespace Innertube
|
|||||||
}
|
}
|
||||||
end function
|
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
|
function FetchTvClientPage(cancellation as object) as dynamic
|
||||||
request = HttpClient.Get("https://www.youtube.com/tv")
|
request = HttpClient.Get("https://www.youtube.com/tv")
|
||||||
headers = Innertube.CreateHeaders(Innertube.ClientType.Tv)
|
headers = Innertube.CreateHeaders(Innertube.ClientType.Tv)
|
||||||
|
|||||||
Reference in new issue
Block a user