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
|
### Fixed
|
||||||
|
|
||||||
- Shorts being merged with subscription videos, regardless of "Disable Shorts" preference.
|
- Shorts being merged with subscription videos, regardless of "Disable Shorts" preference.
|
||||||
|
- Gracefully handle STS_MISMATCH errors
|
||||||
|
|
||||||
## [0.40.14] - 2025-08-22
|
## [0.40.14] - 2025-08-22
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,15 @@ namespace InnertubeService
|
|||||||
return rawResponse
|
return rawResponse
|
||||||
end if
|
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
|
if parsedResponse.error <> invalid
|
||||||
return parsedResponse
|
return parsedResponse
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -409,26 +409,37 @@ namespace Innertube
|
|||||||
|
|
||||||
response = request.Await()
|
response = request.Await()
|
||||||
if not response.IsSuccess()
|
if not response.IsSuccess()
|
||||||
|
LogError(response.ErrorMessage())
|
||||||
|
code = ""
|
||||||
if response.StatusCode() = 400
|
if response.StatusCode() = 400
|
||||||
json = response.Json()
|
json = response.Json()
|
||||||
if IsAssociativeArray(json) and json["code"] = "STS_MISMATCH"
|
if IsAssociativeArray(json)
|
||||||
DeleteFile("tmp:/sts_cache.json")
|
code = ValidString(json["code"])
|
||||||
|
if code = "STS_MISMATCH"
|
||||||
|
DeleteFile("tmp:/sts_cache.json")
|
||||||
|
end if
|
||||||
end if
|
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
|
end if
|
||||||
|
|
||||||
json = response.Json()
|
json = response.Json()
|
||||||
if not IsAssociativeArray(json) or not json.DoesExist("formats")
|
if not IsAssociativeArray(json) or not json.DoesExist("formats")
|
||||||
LogError("Invalid response from decipher service")
|
error = "Invalid response from decipher service"
|
||||||
return adaptiveFormats
|
LogError(error)
|
||||||
|
throw error
|
||||||
end if
|
end if
|
||||||
|
|
||||||
decipheredFormats = json["formats"]
|
decipheredFormats = json["formats"]
|
||||||
if not IsArray(decipheredFormats) or decipheredFormats.Count() <> adaptiveFormats.Count()
|
if not IsArray(decipheredFormats) or decipheredFormats.Count() <> adaptiveFormats.Count()
|
||||||
LogError("Invalid formats in deciphered response")
|
error = "Invalid formats in deciphered response"
|
||||||
return adaptiveFormats
|
LogError(error)
|
||||||
|
throw error
|
||||||
end if
|
end if
|
||||||
|
|
||||||
for i = 0 to decipheredFormats.Count() - 1
|
for i = 0 to decipheredFormats.Count() - 1
|
||||||
|
|||||||
Reference in new issue
Block a user