adjust live video detection to reduce error rate happening on iOS client
This commit is contained in:
1 parent
e389772e87
commit
55e65c42a6
4 files changed
+22
-5
No files matched your search
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- Bug in dash storyboard
|
||||
- Adjust live video detection to reduce error rate happening on iOS client
|
||||
|
||||
## [0.41.8] - 2025-09-07
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace InnertubeService
|
||||
' # Start of iOS fallback
|
||||
playbackTrackingUrls = invalid
|
||||
responseJson = playerResponse.Json()
|
||||
if ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "isLive"])) or ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "isLiveContent"]))
|
||||
if ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "isLive"])) or ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "hasLiveStreamingData"]))
|
||||
LogDebug("Live video detected, falling back to iOS for HLS streams.")
|
||||
isLoggedIn = Innertube.ParseIsLoggedIn(responseJson)
|
||||
playbackTrackingUrls = Innertube.ParsePlaybackTrackingUrls(responseJson, isLoggedIn)
|
||||
|
||||
@@ -86,7 +86,8 @@ namespace Innertube
|
||||
|
||||
lengthSeconds = videoDetails["lengthSeconds"].ToInt()
|
||||
isLive = ValidBool(videoDetails["isLive"])
|
||||
isLiveContent = ValidBool(videoDetails["isLiveContent"])
|
||||
adaptiveFormats = ParseAdaptiveFormats(payload, signatureTimestamp, isLive, cancellation)
|
||||
hasLiveStreamingData = FormatsHaveLiveStreamingData(adaptiveFormats)
|
||||
|
||||
videoInfo = {
|
||||
"type": "video"
|
||||
@@ -98,10 +99,10 @@ namespace Innertube
|
||||
"authorId": videoDetails["channelId"]
|
||||
"lengthSeconds": lengthSeconds
|
||||
"liveNow": isLive
|
||||
"isLiveContent": isLiveContent
|
||||
"hasLiveStreamingData": hasLiveStreamingData
|
||||
"hlsUrl": streamingData["hlsManifestUrl"]
|
||||
"dashUrl": streamingData["dashManifestUrl"]
|
||||
"adaptiveFormats": ParseAdaptiveFormats(payload, signatureTimestamp, isLive or isLiveContent, cancellation)
|
||||
"adaptiveFormats": adaptiveFormats
|
||||
"formatStreams": []
|
||||
"captions": ParseCaptions(payload)
|
||||
"recommendedVideos": []
|
||||
@@ -510,4 +511,19 @@ namespace Innertube
|
||||
"videostatsWatchtimeUrl": ObjectUtils.Dig(playbackTracking, ["videostatsWatchtimeUrl", "baseUrl"])
|
||||
}
|
||||
end function
|
||||
|
||||
function FormatsHaveLiveStreamingData(adaptiveFormats as object) as boolean
|
||||
if not IsArray(adaptiveFormats)
|
||||
return false
|
||||
end if
|
||||
|
||||
for each fmt in adaptiveFormats
|
||||
url = fmt["url"]
|
||||
if IsString(url) and url.InStr("yt_live_broadcast") <> -1
|
||||
return true
|
||||
end if
|
||||
end for
|
||||
|
||||
return false
|
||||
end function
|
||||
end namespace
|
||||
@@ -122,7 +122,7 @@ namespace Http
|
||||
end if
|
||||
|
||||
' TODO:P2: handle live videos
|
||||
if ValidBool(metadata.liveNow) or ValidBool(metadata.isLiveContent)
|
||||
if ValidBool(metadata.liveNow) or ValidBool(metadata.hasLiveStreamingData)
|
||||
return hlsManifest
|
||||
end if
|
||||
|
||||
|
||||
Reference in new issue
Block a user