Viblast / hls-proxy

Easy downloading and mirroring of HLS streams
MIT License
109 stars 50 forks source link

Proxying urls with auth keys #11

Closed djzang closed 7 years ago

djzang commented 7 years ago

I have a source that has an authentication key in the HLS url which expires every 4 hours. I have a bash script to obtain the new key and store it in ./key. I tried launching the script like this:

./start-proxy.sh http://some.server.com:1234/playlist.m3u8?Auth=`cat key` -o /tmp/hls/

This works initially, but when the key changes the python script continues to use the old key. I assume its putting the initial key in a variable which never gets updated. Any suggestions on how to fix this?

svetlin-mladenov commented 7 years ago

When you execute:

./start-proxy.sh http://some.server.com:1234/playlist.m3u8?Auth=`cat key` -o /tmp/hls/

The shell (most commonly bash) is replacing the cat key part with the content of the key file. The hls-proxy doesn't even know that this file exists and cannot do anything when it changes.

The solution is to manually monitor the file (for example with inotifywait) and restart hls-proxy whenever the file changes.

I am closing this issue because this functionality is too specific to your case and not something that needs to be added to `hls-proxy'.