Gracefully handle STS_MISMATCH errors
This commit is contained in:
1 parent
5a2e8b1f4a
commit
0bed5598f4
3 files changed
+29
-9
No files matched your search
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- Shorts being merged with subscription videos, regardless of "Disable Shorts" preference.
|
||||
- Gracefully handle STS_MISMATCH errors
|
||||
|
||||
## [0.40.14] - 2025-08-22
|
||||
|
||||
|
||||
@@ -103,7 +103,15 @@ namespace InnertubeService
|
||||
return rawResponse
|
||||
end if
|
||||
|
||||
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, cancellation)
|
||||
parsedResponse = invalid
|
||||
try
|
||||
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, cancellation)
|
||||
catch exception
|
||||
if ValidString(exception.code) = "STS_MISMATCH"
|
||||
return GetVideoMetadata(videoId, options)
|
||||
end if
|
||||
throw exception
|
||||
end try
|
||||
if parsedResponse.error <> invalid
|
||||
return parsedResponse
|
||||
end if
|
||||
|
||||
@@ -409,26 +409,37 @@ namespace Innertube
|
||||
|
||||
response = request.Await()
|
||||
if not response.IsSuccess()
|
||||
LogError(response.ErrorMessage())
|
||||
code = ""
|
||||
if response.StatusCode() = 400
|
||||
json = response.Json()
|
||||
if IsAssociativeArray(json) and json["code"] = "STS_MISMATCH"
|
||||
DeleteFile("tmp:/sts_cache.json")
|
||||
if IsAssociativeArray(json)
|
||||
code = ValidString(json["code"])
|
||||
if code = "STS_MISMATCH"
|
||||
DeleteFile("tmp:/sts_cache.json")
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
LogError(response.ErrorMessage())
|
||||
return adaptiveFormats
|
||||
|
||||
exception = { message: response.ErrorMessage() }
|
||||
if code <> ""
|
||||
exception.code = code
|
||||
end if
|
||||
throw exception
|
||||
end if
|
||||
|
||||
json = response.Json()
|
||||
if not IsAssociativeArray(json) or not json.DoesExist("formats")
|
||||
LogError("Invalid response from decipher service")
|
||||
return adaptiveFormats
|
||||
error = "Invalid response from decipher service"
|
||||
LogError(error)
|
||||
throw error
|
||||
end if
|
||||
|
||||
decipheredFormats = json["formats"]
|
||||
if not IsArray(decipheredFormats) or decipheredFormats.Count() <> adaptiveFormats.Count()
|
||||
LogError("Invalid formats in deciphered response")
|
||||
return adaptiveFormats
|
||||
error = "Invalid formats in deciphered response"
|
||||
LogError(error)
|
||||
throw error
|
||||
end if
|
||||
|
||||
for i = 0 to decipheredFormats.Count() - 1
|
||||
|
||||
Reference in new issue
Block a user