Open akillar opened 4 years ago
using the 24/7 CBS News live stream as a sample m3u8 URL
to obtain a proxied URL in bash:
proxy='127.0.0.1:8080'
URL='https://www.cbsnews.com/common/video/cbsn_header_prod.m3u8'
URL=$(echo "$URL" | base64 --wrap=0)
URL="http://${proxy}/${URL}.m3u8"
echo $URL
to obtain a proxied URL in javascript:
{
const proxy = '127.0.0.1:8080'
let URL
URL = 'https://www.cbsnews.com/common/video/cbsn_header_prod.m3u8'
URL = window.btoa(URL)
URL = `http://${proxy}/${URL}.m3u8`
console.log(URL)
}
tool that can be used to simplify this task:
a cheat to use the SPAs without the Chrome extension:
https://www.cbsnews.com/common/video/cbsn_header_prod.m3u8
http://webcast-reloaded.surge.sh/1-webcast/index.html#/watch/aHR0cHM6Ly93d3cuY2JzbmV3cy5jb20vY29tbW9uL3ZpZGVvL2Nic25faGVhZGVyX3Byb2QubTN1OA%253D%253D
1-webcast/index.html
with proxy.html
http://webcast-reloaded.surge.sh/proxy.html#/watch/aHR0cHM6Ly93d3cuY2JzbmV3cy5jb20vY29tbW9uL3ZpZGVvL2Nic25faGVhZGVyX3Byb2QubTN1OA%253D%253D
PS: since you mentioned opening ports in your server's firewall, I'll mention that you'll want to replace 127.0.0.1
in all of the examples above with an IP that's reachable from your client. For example, on your LAN the IP might look something like 192.168.0.100
.
thank you @warren-bank.
@warren-bank is it possible to use a domain name instead of a ip address for the const proxy = '127.0.0.1:8080'
yes.. so long as the client that you're using to download the stream through the proxy can use DNS to resolve your domain name to an IP address, then you certainly can.
{
const proxy = 'https://my-hls-proxy.com:443'
let URL
URL = 'https://www.cbsnews.com/common/video/cbsn_header_prod.m3u8'
URL = window.btoa(URL)
URL = `${proxy}/${URL}.m3u8`
console.log(URL)
}
you can play around with this by editing the hosts file on your computer.. to override DNS resolution locally for testing
127.0.0.1 my-hls-proxy.com
How do you use this proxy to stream a m3u8 url. i've installed the proxy globally and started the proxy using the command + allowed ports in the firewall. but how do i use my m3u8 url to use this proxy ?