More reliable stream URLs

live_tv_play
Juraj Nyíri 3 years ago
parent 29e174a1bf
commit 7635cc351c

@ -19033,13 +19033,15 @@ class Plex {
let res = await axios.get(this.authorizeURL(decisionURL), { let res = await axios.get(this.authorizeURL(decisionURL), {
timeout: this.requestTimeout timeout: this.requestTimeout
}); });
console.log(res); while (parseFloat(res.data.MediaContainer.Metadata[0].Media[0].Part[0].key.split('offset=')[1].split('&')[0]) < 10) {
console.log('Waiting for new url...'); // eslint-disable-next-line no-await-in-loop
await sleep(10000); await sleep(500);
// eslint-disable-next-line no-await-in-loop
res = await axios.get(this.authorizeURL(decisionURL), { res = await axios.get(this.authorizeURL(decisionURL), {
timeout: this.requestTimeout timeout: this.requestTimeout
}); });
console.log(res); console.log('Waiting for new url...');
}
return res.data.MediaContainer.Metadata[0].Media[0].Part[0].key; return res.data.MediaContainer.Metadata[0].Media[0].Part[0].key;
}; };
this.getContinueWatching = async () => { this.getContinueWatching = async () => {

@ -475,15 +475,17 @@ class Plex {
let res = await axios.get(this.authorizeURL(decisionURL), { let res = await axios.get(this.authorizeURL(decisionURL), {
timeout: this.requestTimeout timeout: this.requestTimeout
}); });
console.log(res); while (
parseFloat(res.data.MediaContainer.Metadata[0].Media[0].Part[0].key.split('offset=')[1].split('&')[0]) < 10
console.log('Waiting for new url...'); ) {
await sleep(10000); // eslint-disable-next-line no-await-in-loop
await sleep(500);
// eslint-disable-next-line no-await-in-loop
res = await axios.get(this.authorizeURL(decisionURL), { res = await axios.get(this.authorizeURL(decisionURL), {
timeout: this.requestTimeout timeout: this.requestTimeout
}); });
console.log(res); console.log('Waiting for new url...');
}
return res.data.MediaContainer.Metadata[0].Media[0].Part[0].key; return res.data.MediaContainer.Metadata[0].Media[0].Part[0].key;
}; };

Loading…
Cancel
Save