Fix for bookmarked invalid videos (#255)
* Fix for bookmarked invalid videos * Update InvidiousService.bs * Change status code
This commit is contained in:
1 parent
5ff02af7ac
commit
3edfce1366
2 files changed
+22
-3
No files matched your search
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- `HTTP/0.9 when not allowed` errors by adding a retry to web requests
|
||||
- Issue where a bookmarked video is no longer valid (such as a video made private, or a live stream that ended)
|
||||
|
||||
## [0.18.1] - 2024-01-02
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Invidious
|
||||
|
||||
m.endpoints = node.apiDefinitions
|
||||
|
||||
m.responseHanlders = {
|
||||
m.responseHandlers = {
|
||||
DefaultHandler: m.DefaultHandler
|
||||
AuthFeedHandler: m.AuthFeedHandler
|
||||
PlaylistHandler: m.PlaylistHandler
|
||||
@@ -291,7 +291,7 @@ namespace Invidious
|
||||
|
||||
response = request.Await()
|
||||
|
||||
responseHandler = endpoint.responseHandler <> invalid ? m.responseHanlders[endpoint.responseHandler] : m.responseHanlders["DefaultHandler"]
|
||||
responseHandler = endpoint.responseHandler <> invalid ? m.responseHandlers[endpoint.responseHandler] : m.responseHandlers["DefaultHandler"]
|
||||
|
||||
result = responseHandler(m, feedSource, response)
|
||||
|
||||
@@ -351,13 +351,31 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function VideoInfoHandler(m as object, feedSource as object, response as object) as object
|
||||
if response.StatusCode() = 200
|
||||
statusCode = response.StatusCode()
|
||||
if statusCode >= 500
|
||||
' In some cases, such as a video became private, or a live stream ended,
|
||||
' Invidious returns a 500 error. We can in this case return a valid response
|
||||
' with just a video id, which will allow us to show a valid thumbnail if possible.
|
||||
' This is to makes it possible to load a bookmarked video and delete it even if
|
||||
' it is no longer valid.
|
||||
' TODO:P2 access to private property
|
||||
response._statusCode = 200
|
||||
return {
|
||||
items: [{
|
||||
"videoId": feedSource.pathParams.id
|
||||
"type": "video"
|
||||
}]
|
||||
}
|
||||
end if
|
||||
|
||||
if statusCode = 200
|
||||
json = response.Json()
|
||||
json.type = "video"
|
||||
return {
|
||||
items: [json]
|
||||
}
|
||||
end if
|
||||
|
||||
return invalid
|
||||
end function
|
||||
|
||||
|
||||
Reference in new issue
Block a user