54ac / stream-detector

A Firefox addon for keeping track of manifests used by various streaming protocols and downloading media files.
https://addons.mozilla.org/en-US/firefox/addon/hls-stream-detector/
Mozilla Public License 2.0
643 stars 97 forks source link

Support for Kodi URL Format #56

Closed Genius1237 closed 3 years ago

Genius1237 commented 3 years ago

Kodi supports playing HLS/M3u8 streams (https://kodi.wiki/view/Internet_video_and_audio_streams). It even supports passing custom HTTP headers (https://kodi.wiki/view/HTTP). The URL is to be given in the following format

http://host/path/stream|Header1=value&Header2=value

Eg: Header1 = Referer, Header2=User-Agent etc..

Would it be possible to add an option to generate the URLs in this format? It seems like something simple to implement.

I wouldn't mind implementing it myself, but I really have no experience with javascript or firefox addons. If you could give me some pointers on where to make changes to the code, I can give it a try.

54ac commented 3 years ago

Good idea. I'll look into it.

54ac commented 3 years ago

This is now available in v2.7.2. Let me know if it works.

Genius1237 commented 3 years ago

There seems to be a small issue with the URL format. It's generating it in the form

http://host/path/stream|Header1:"value"|Header2:"value"

It should be

http://host/path/stream|Header1=value&Header2=value

Spaces within the value of each header isn't an issue, as kodi parses the entire line.

Genius1237 commented 3 years ago

I'm not able to find a site that has a HLS that requires the referer header to test out. I used to use one, but it doesn't work anymore. Is there some site that you know?

54ac commented 3 years ago

There seems to be a small issue with the URL format. It's generating it in the form

http://host/path/stream|Header1:"value"|Header2:"value"

I did this on purpose, in case any of the values contains a | symbol. Does Kodi not parse quotation marks in this case?

I'm not able to find a site that has a HLS that requires the referer header to test out. I used to use one, but it doesn't work anymore. Is there some site that you know?

Not specifically, but I use this random file sometimes, seems to do the job.

Genius1237 commented 3 years ago

I did a bit of testing with a local server and looked at the headers.

It seems to require an & separating every header, not a |. The | is just to know at which point it is transitioning from the URL to the headers.

Kodi doesn't parse quotation marks. If I specify the headers in the form Header1="value", it sends the value of Header1 as "value" and not value.

54ac commented 3 years ago

Thanks for investigating this further. I have applied the necessary fixes in v2.7.3. Let me know if it works now.

Genius1237 commented 3 years ago

It seems to be passing the headers properly, so I'm gonna assume that it's working. There are some other issues with the streams that I used to test this, so the actual stream isn't playing (via kodi or other methods like youtube-dl).

Thanks for implementing this. I'll close the issue for now as things are seem to be working.