-
Notifications
You must be signed in to change notification settings - Fork 80
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
Handling reauth of a channel m3u that redirects to a CDN back-end? #41
Comments
Interesting problem.. off-hand, I'd guess that this is probably video player dependent; If so, then the former player would work fine with your provider, Also, if so, then the question you pose is.. Currently, no.
for example (untested, just some quick pseudo-code): // hooks.js
// map: lastURL to firstURL
const manifestsMap = {}
const onManifestRedirect = (urlsArray) => {
if (urlsArray && Array.isArray(urlsArray) && (urlsArray.length > 1)) {
const lastURL = urlsArray[urlsArray.length - 1]
const firstURL =urlsArray[0]
manifestsMap[lastURL] = firstURL
}
}
const onManifestError = (url, status) => {
if ((status >= 400) && (status < 500) && manifestsMap[url]) {
return {
"status": 301,
"url": manifestsMap[url]
}
}
}
module.exports = {
onManifestRedirect,
onManifestError
} |
I don't think I've come across a player that works around it yet, though I haven't had the time to test to that degree. The streams can take 4h to cut out sometimes and I don't have enough free time available to try to repro in something like VLC. I can pull examples from past logging though if you want to see exactly what happens when the other hls-proxy errors out. I'm still learning HLS terminology, manifest would be the m3u that lists the .ts segments? If so I'm not completely sure if the error is thrown when it's trying to fetch the manifest or only the resulting .ts segments but I can pull some examples from my logs to verify. If I'm understanding this code properly you're essentially keeping track of the URL you called vs the URL you ended up at to get the m3u, then if you receive an error you are redirecting yourself back to the 1st URL so you can be redirected again. How would I go about coding/testing a hook function? Assuming the above was functional would the proxy understand what to do with those new functions? I'm seasoned when it comes to infrastructure but green when it comes to code. |
In so far as your understanding of what that code is doing.. you're absolutely correct. HLS terminology is pretty simple:
IPTV terminology is confusing:
with respect to testing different video players..
I'm not suggesting that you actually need to do any of that.. |
so.. I just reread and reconsidered everything I'd previously said after the benefit of a little sleep.. The short answer is: yes The longer answer is:
Sorry! Anyway, my suggestion is to give this proxy a test.. |
PS: I checked some old notes and confirmed that I've tested and used "tvnow.best" in the past.. and really liked this service a lot. These streams are HLS and will work perfectly with the proxy. |
I would be interested in comparing notes, do you have a discord server or some way we can connect outside github? |
I hadn't used Discord before.. not the most "social" person ever. |
DM is disabled, you can try me there, same username. I think you have to add me as a friend by username. |
You seem to be open to exploring new use cases, how about this one? I'm currently using https://www.hls-proxy.com/ and looking for an alternative since it can't handle this.
I've been doing some testing and noticed that my provider requires regular re-auth of the stream to keep it alive.
The channel M3U URL looks like this inside the master playlist:
https://tvnow.best/api/stream/username/password/livetv.epg/channel.name.m3u8
When you GET it you receive a 301 redirect to something like this which is hosted on cloudflare:
https://183-81-168-251.servers.party:5052/live22/DnUJ1vfuNxq-KIzI2GFbvw/312330/1706784248/3041567.m3u8
After an amount of time, the cloudflare servers throw a 410 error or 403 error when you try to GET the M3U or the .ts files and the stream drops. If you re-call the channel level m3u you are happily redirected to the content and can resume playing it.
Any chance you would be interested in adding this type of error handling / channel source resume functionality into your proxy?
The text was updated successfully, but these errors were encountered: