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/),
|
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]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Removed PoToken usage
|
||||||
|
|
||||||
## [0.40.11] - 2025-08-18
|
## [0.40.11] - 2025-08-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace InnertubeService
|
|||||||
return rawResponse
|
return rawResponse
|
||||||
end if
|
end if
|
||||||
|
|
||||||
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, playerRequest.poToken, cancellation)
|
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, cancellation)
|
||||||
if parsedResponse.error <> invalid
|
if parsedResponse.error <> invalid
|
||||||
return parsedResponse
|
return parsedResponse
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import "pkg:/components/Services/Innertube/Context.bs"
|
import "pkg:/components/Services/Innertube/Context.bs"
|
||||||
import "pkg:/components/Services/Innertube/NodesParser.bs"
|
import "pkg:/components/Services/Innertube/NodesParser.bs"
|
||||||
import "pkg:/components/Services/Innertube/PoToken.bs"
|
|
||||||
import "pkg:/source/services/HttpClient.bs"
|
import "pkg:/source/services/HttpClient.bs"
|
||||||
import "pkg:/source/utils/ObjectUtils.bs"
|
import "pkg:/source/utils/ObjectUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
@@ -13,7 +12,6 @@ namespace Innertube
|
|||||||
visitorData = OptionUtils.Get(options, "visitorData")
|
visitorData = OptionUtils.Get(options, "visitorData")
|
||||||
accessToken = OptionUtils.Get(options, "accessToken")
|
accessToken = OptionUtils.Get(options, "accessToken")
|
||||||
doSignatureTimestamp = ValidBool(OptionUtils.Get(options, "signatureTimestamp"))
|
doSignatureTimestamp = ValidBool(OptionUtils.Get(options, "signatureTimestamp"))
|
||||||
doPoToken = ValidBool(OptionUtils.Get(options, "poToken"))
|
|
||||||
|
|
||||||
useAccessToken = client = Innertube.ClientType.TV and not StringUtils.IsNullOrEmpty(accessToken)
|
useAccessToken = client = Innertube.ClientType.TV and not StringUtils.IsNullOrEmpty(accessToken)
|
||||||
|
|
||||||
@@ -52,14 +50,6 @@ namespace Innertube
|
|||||||
end if
|
end if
|
||||||
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 = HttpClient.PostJson("https://www.youtube.com/youtubei/v1/player?prettyPrint=false&alt=json", payload)
|
||||||
request.Headers(Innertube.CreateHeaders(client))
|
request.Headers(Innertube.CreateHeaders(client))
|
||||||
|
|
||||||
@@ -68,12 +58,11 @@ namespace Innertube
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
request.signatureTimestamp = signatureTimestamp
|
request.signatureTimestamp = signatureTimestamp
|
||||||
request.poToken = poToken
|
|
||||||
|
|
||||||
return request
|
return request
|
||||||
end function
|
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)
|
error = ParsePlayerResponseForError(payload)
|
||||||
if error <> ""
|
if error <> ""
|
||||||
return {
|
return {
|
||||||
@@ -109,7 +98,7 @@ namespace Innertube
|
|||||||
"liveNow": ValidBool(videoDetails["isLive"])
|
"liveNow": ValidBool(videoDetails["isLive"])
|
||||||
"hlsUrl": streamingData["hlsManifestUrl"]
|
"hlsUrl": streamingData["hlsManifestUrl"]
|
||||||
"dashUrl": streamingData["dashManifestUrl"]
|
"dashUrl": streamingData["dashManifestUrl"]
|
||||||
"adaptiveFormats": ParseAdaptiveFormats(payload, signatureTimestamp, poToken, cancellation)
|
"adaptiveFormats": ParseAdaptiveFormats(payload, signatureTimestamp, cancellation)
|
||||||
"hasDecodedDashUrls": true
|
"hasDecodedDashUrls": true
|
||||||
"formatStreams": []
|
"formatStreams": []
|
||||||
"captions": ParseCaptions(payload)
|
"captions": ParseCaptions(payload)
|
||||||
@@ -299,13 +288,13 @@ namespace Innertube
|
|||||||
return captions
|
return captions
|
||||||
end function
|
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"])
|
adaptiveFormats = ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"])
|
||||||
if not IsArray(adaptiveFormats)
|
if not IsArray(adaptiveFormats)
|
||||||
return []
|
return []
|
||||||
end if
|
end if
|
||||||
|
|
||||||
adaptiveFormats = DecipherUrls(adaptiveFormats, signatureTimestamp, poToken, cancellation)
|
adaptiveFormats = DecipherUrls(adaptiveFormats, signatureTimestamp, cancellation)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for each fmt in adaptiveFormats
|
for each fmt in adaptiveFormats
|
||||||
@@ -393,7 +382,7 @@ namespace Innertube
|
|||||||
return json["sts"]
|
return json["sts"]
|
||||||
end function
|
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
|
if signatureTimestamp = invalid
|
||||||
' No need to decipher if signatureTimestamp is not available
|
' No need to decipher if signatureTimestamp is not available
|
||||||
return adaptiveFormats
|
return adaptiveFormats
|
||||||
@@ -411,7 +400,6 @@ namespace Innertube
|
|||||||
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v1/decipher`, {
|
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v1/decipher`, {
|
||||||
"sts": signatureTimestamp
|
"sts": signatureTimestamp
|
||||||
"formats": formats
|
"formats": formats
|
||||||
"poToken": poToken
|
|
||||||
})
|
})
|
||||||
request.Cancellation(cancellation)
|
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
|
"accessToken": accessToken
|
||||||
"onBehalfOfUser": onBehalfOfUser
|
"onBehalfOfUser": onBehalfOfUser
|
||||||
"signatureTimestamp": true
|
"signatureTimestamp": true
|
||||||
"poToken": true
|
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
||||||
|
|||||||
Reference in new issue
Block a user