Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invidious API: Extract streaming data expiry date from URL #5997

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
*/
Expand Down