Skip to content

Commit 1d1221b

Browse files
absidueAlban Dumas
authored and
Alban Dumas
committed
Invidious API: Extract streaming data expiry date from URL (FreeTubeApp#5997)
1 parent dfe64e0 commit 1d1221b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/renderer/views/Watch/Watch.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,8 @@ export default defineComponent({
848848
// // https://github.com/iv-org/invidious/pull/4589
849849
// if (this.proxyVideos) {
850850

851+
this.streamingDataExpiryDate = this.extractExpiryDateFromStreamingUrl(result.adaptiveFormats[0].url)
852+
851853
let hlsManifestUrl = result.hlsUrl
852854

853855
if (this.proxyVideos) {
@@ -876,6 +878,8 @@ export default defineComponent({
876878
} else {
877879
this.videoLengthSeconds = result.lengthSeconds
878880

881+
this.streamingDataExpiryDate = this.extractExpiryDateFromStreamingUrl(result.adaptiveFormats[0].url)
882+
879883
this.legacyFormats = result.formatStreams.map(mapInvidiousLegacyFormat)
880884

881885
if (!process.env.SUPPORTS_LOCAL_API || this.proxyVideos) {
@@ -945,6 +949,12 @@ export default defineComponent({
945949
})
946950
},
947951

952+
extractExpiryDateFromStreamingUrl: function (url) {
953+
const expireString = new URL(url).searchParams.get('expire')
954+
955+
return new Date(parseInt(expireString) * 1000)
956+
},
957+
948958
/**
949959
* @param {string} description
950960
*/

0 commit comments

Comments
 (0)