Remove potoken
This commit is contained in:
1 parent
9119438dc9
commit
638ce18aa8
5 files changed
+12
-71
No files matched your search
@@ -5,6 +5,12 @@ 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]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Removed PoToken usage
|
||||
|
||||
## [0.40.11] - 2025-08-18
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace InnertubeService
|
||||
return rawResponse
|
||||
end if
|
||||
|
||||
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, playerRequest.poToken, cancellation)
|
||||
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, cancellation)
|
||||
if parsedResponse.error <> invalid
|
||||
return parsedResponse
|
||||
end if
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import "pkg:/components/Services/Innertube/Context.bs"
|
||||
import "pkg:/components/Services/Innertube/NodesParser.bs"
|
||||
import "pkg:/components/Services/Innertube/PoToken.bs"
|
||||
import "pkg:/source/services/HttpClient.bs"
|
||||
import "pkg:/source/utils/ObjectUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
@@ -13,7 +12,6 @@ namespace Innertube
|
||||
visitorData = OptionUtils.Get(options, "visitorData")
|
||||
accessToken = OptionUtils.Get(options, "accessToken")
|
||||
doSignatureTimestamp = ValidBool(OptionUtils.Get(options, "signatureTimestamp"))
|
||||
doPoToken = ValidBool(OptionUtils.Get(options, "poToken"))
|
||||
|
||||
useAccessToken = client = Innertube.ClientType.TV and not StringUtils.IsNullOrEmpty(accessToken)
|
||||
|
||||
@@ -52,14 +50,6 @@ namespace Innertube
|
||||
end if
|
||||
end if
|
||||
|
||||
poToken = invalid
|
||||
if doPoToken
|
||||
poToken = Innertube.GetPoToken(visitorData, videoId, cancellation)
|
||||
payload["serviceIntegrityDimensions"] = {
|
||||
"poToken": poToken
|
||||
}
|
||||
end if
|
||||
|
||||
request = HttpClient.PostJson("https://www.youtube.com/youtubei/v1/player?prettyPrint=false&alt=json", payload)
|
||||
request.Headers(Innertube.CreateHeaders(client))
|
||||
|
||||
@@ -68,12 +58,11 @@ namespace Innertube
|
||||
end if
|
||||
|
||||
request.signatureTimestamp = signatureTimestamp
|
||||
request.poToken = poToken
|
||||
|
||||
return request
|
||||
end function
|
||||
|
||||
function ParseInnertubePlayerResponse(payload as object, signatureTimestamp as dynamic, poToken as dynamic, cancellation as object) as object
|
||||
function ParseInnertubePlayerResponse(payload as object, signatureTimestamp as dynamic, cancellation as object) as object
|
||||
error = ParsePlayerResponseForError(payload)
|
||||
if error <> ""
|
||||
return {
|
||||
@@ -109,7 +98,7 @@ namespace Innertube
|
||||
"liveNow": ValidBool(videoDetails["isLive"])
|
||||
"hlsUrl": streamingData["hlsManifestUrl"]
|
||||
"dashUrl": streamingData["dashManifestUrl"]
|
||||
"adaptiveFormats": ParseAdaptiveFormats(payload, signatureTimestamp, poToken, cancellation)
|
||||
"adaptiveFormats": ParseAdaptiveFormats(payload, signatureTimestamp, cancellation)
|
||||
"hasDecodedDashUrls": true
|
||||
"formatStreams": []
|
||||
"captions": ParseCaptions(payload)
|
||||
@@ -299,13 +288,13 @@ namespace Innertube
|
||||
return captions
|
||||
end function
|
||||
|
||||
function ParseAdaptiveFormats(payload as object, signatureTimestamp as dynamic, poToken as dynamic, cancellation as object) as object
|
||||
function ParseAdaptiveFormats(payload as object, signatureTimestamp as dynamic, cancellation as object) as object
|
||||
adaptiveFormats = ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"])
|
||||
if not IsArray(adaptiveFormats)
|
||||
return []
|
||||
end if
|
||||
|
||||
adaptiveFormats = DecipherUrls(adaptiveFormats, signatureTimestamp, poToken, cancellation)
|
||||
adaptiveFormats = DecipherUrls(adaptiveFormats, signatureTimestamp, cancellation)
|
||||
|
||||
formats = []
|
||||
for each fmt in adaptiveFormats
|
||||
@@ -393,7 +382,7 @@ namespace Innertube
|
||||
return json["sts"]
|
||||
end function
|
||||
|
||||
function DecipherUrls(adaptiveFormats as object, signatureTimestamp as dynamic, poToken as dynamic, cancellation as object) as object
|
||||
function DecipherUrls(adaptiveFormats as object, signatureTimestamp as dynamic, cancellation as object) as object
|
||||
if signatureTimestamp = invalid
|
||||
' No need to decipher if signatureTimestamp is not available
|
||||
return adaptiveFormats
|
||||
@@ -411,7 +400,6 @@ namespace Innertube
|
||||
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v1/decipher`, {
|
||||
"sts": signatureTimestamp
|
||||
"formats": formats
|
||||
"poToken": poToken
|
||||
})
|
||||
request.Cancellation(cancellation)
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
namespace Innertube
|
||||
function GetPoToken(visitorData as string, bindingIdentifier as string, cancellation as object) as string
|
||||
requestCount = 1
|
||||
payload = {
|
||||
"visitorData": visitorData
|
||||
"bindingIdentifier": bindingIdentifier
|
||||
}
|
||||
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v1/botguard`, payload)
|
||||
request.Cancellation(cancellation)
|
||||
|
||||
while requestCount < 5
|
||||
response = request.Await()
|
||||
if not response.IsSuccess()
|
||||
throw "Failed to get PoToken: " + response.ErrorMessage()
|
||||
end if
|
||||
|
||||
json = response.Json()
|
||||
if not IsAssociativeArray(json)
|
||||
throw "Invalid response format for PoToken: " + response.Text()
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(json["poToken"])
|
||||
return json["poToken"]
|
||||
end if
|
||||
|
||||
if json["action"] = "FETCH"
|
||||
fetchData = json["fetch"]
|
||||
request = new HttpClient.HttpRequest()
|
||||
request.Url(fetchData.url)
|
||||
request.Method(fetchData.method)
|
||||
request.Headers(fetchData.headers)
|
||||
request.Body(fetchData.body)
|
||||
request.Cancellation(cancellation)
|
||||
|
||||
response = request.Await()
|
||||
if not response.IsSuccess()
|
||||
throw "Failed to fetch PoToken: " + response.ErrorMessage()
|
||||
end if
|
||||
|
||||
payload["fetchResponse"] = response.Text()
|
||||
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v1/botguard`, payload)
|
||||
request.Cancellation(cancellation)
|
||||
else
|
||||
throw "Failed to get PoToken: " + response.Text()
|
||||
end if
|
||||
|
||||
requestCount = requestCount + 1
|
||||
end while
|
||||
|
||||
throw "Failed to get PoToken after multiple attempts"
|
||||
end function
|
||||
end namespace
|
||||
@@ -58,7 +58,6 @@ function ExecuteJob() as void
|
||||
"accessToken": accessToken
|
||||
"onBehalfOfUser": onBehalfOfUser
|
||||
"signatureTimestamp": true
|
||||
"poToken": true
|
||||
})
|
||||
else
|
||||
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
||||
|
||||
Reference in new issue
Block a user