diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 082ef53682cd8..7e07c36687fe4 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -848,6 +848,8 @@ export default defineComponent({ // // https://github.com/iv-org/invidious/pull/4589 // if (this.proxyVideos) { + this.streamingDataExpiryDate = this.extractExpiryDateFromStreamingUrl(result.adaptiveFormats[0].url) + let hlsManifestUrl = result.hlsUrl if (this.proxyVideos) { @@ -876,6 +878,8 @@ export default defineComponent({ } else { this.videoLengthSeconds = result.lengthSeconds + this.streamingDataExpiryDate = this.extractExpiryDateFromStreamingUrl(result.adaptiveFormats[0].url) + this.legacyFormats = result.formatStreams.map(mapInvidiousLegacyFormat) if (!process.env.SUPPORTS_LOCAL_API || this.proxyVideos) { @@ -945,6 +949,12 @@ export default defineComponent({ }) }, + extractExpiryDateFromStreamingUrl: function (url) { + const expireString = new URL(url).searchParams.get('expire') + + return new Date(parseInt(expireString) * 1000) + }, + /** * @param {string} description */