Skip to content
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

[Feature request] Pass mpd URL custom headers to actual video files? [clearkey DRM] #1684

Closed
enerdude opened this issue Oct 4, 2024 · 9 comments
Labels
Resolution: External a real bug, but not in the code of this repo

Comments

@enerdude
Copy link

enerdude commented Oct 4, 2024

Describe the feature

Hi I have a similar request to #20

My case is not widevine drm but clearkey drm instead. My m3u entry is e.g.

#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.drm_legacy=org.w3.clearkey|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
https://example.com/manifest.mpd|Origin=https://example.com

The issue is that the custom 'Origin' header is applied to downloading the manifest but not to the following segments which leads to a http 403 forbidden in my case

Motivation

I can see this as someting other people can also use.

Are you willing to contribute in development?

No

Should a possible backport be considered?

No

@enerdude enerdude added the Type: Feature non-breaking change which adds functionality label Oct 4, 2024
@CastagnaIT CastagnaIT added Resolution: External a real bug, but not in the code of this repo and removed Type: Feature non-breaking change which adds functionality labels Oct 4, 2024
@CastagnaIT
Copy link
Collaborator

this is not a feature request
you are using a malformed manifest request url by using pipe | char

pipe char is not allowed on this addon

there are explicit header properties to be used, read wiki
https://github.com/xbmc/inputstream.adaptive/wiki/Integration

@enerdude
Copy link
Author

enerdude commented Oct 4, 2024

Thanks for your quick reply.
Excuse my ignorance when it comes to programming in general as well as doing add-ons.
If I understand it correct I must set a property e.g.
https://github.com/xbmc/inputstream.adaptive/wiki/Integration#inputstreamadaptivestream_headers

Assuming I'm not writing a plugin / just creating a .strm / .m3u file, how would I specify these properties or is there an example skeleton add-on I can modify to enable me to use 'plugin://' in my playlist to play just one encrypted item?

Edit: or is there a way to use '#KODIPROP:' to set these headers and therefore not needing to create an addon?

@CastagnaIT
Copy link
Collaborator

Assuming I'm not writing a plugin / just creating a .strm / .m3u file, how would I specify these properties

if you look at example on top of wiki page, there is the example
just add new KODIPROP: lines with your properties having the appropriate value after "=" char

or is there an example skeleton add-on I can modify

not skeleton, but you can take ispiration from #1678 and modify it,
anyway exists many kodi addons that integrate ISAdaptive just make some searchs on the web

@enerdude
Copy link
Author

enerdude commented Oct 4, 2024

Ok thanks

One last question if I need to set:
listitem.setProperty('inputstream.adaptive.stream_headers', 'headername=value')

do I do:
#KODIPROP:inputstream.adaptive.stream_headers=headername=value ?

@CastagnaIT
Copy link
Collaborator

yep exactly

@enerdude
Copy link
Author

enerdude commented Oct 4, 2024

Does not work.

I also tried
#KODIPROP:inputstream.adaptive.stream_headers=['Origin=https://example.com']

When I sniff the traffic, the origin headers is not added

Surely
#KODIPROP:inputstream.adaptive.stream_headers=headername=value

cannot work cause there is 2 '=' signs on one line?

@CastagnaIT
Copy link
Collaborator

#KODIPROP:inputstream.adaptive.stream_headers=['Origin=https://example.com']

must be
#KODIPROP:inputstream.adaptive.stream_headers=Origin=https://example.com
for correctness the header should be url encoded
#KODIPROP:inputstream.adaptive.stream_headers=Origin=https%3A%2F%2Fexample.com

if you read in full the wiki, the stream_headers is applied to streams requests only,
if you want to apply to manifest or license are separate properties

@CastagnaIT CastagnaIT closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
@enerdude
Copy link
Author

enerdude commented Oct 4, 2024

Thanks so much for your help! Did not mean to waste your time but as I said I don't know much about programming in general.

Just for future reference for people with the same "problem", my final solution was:

#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.drm_legacy=org.w3.clearkey|xxxx:xxxx
#KODIPROP:inputstream.adaptive.manifest_headers=Origin=https%3A%2F%2Fexample.com
#KODIPROP:inputstream.adaptive.stream_headers=Origin=https%3A%2F%2Fexample.com
https://example.com/manifest.mpd|Origin=https://example.com

Note I still had to put the |Origin=https://example.com after the manifest otherwise the first HEAD and GET got 403 errors even though after that it still worked. I am a perfectionist so I rather put it this way.

I have another question for you even though unrelated to this add-on. I have asked on kodi forums and other places but could never get an answer. When I want to play an url in a strm / m3u file, is there any way to specify a proxy (http / socks) via the '|' or even a #KODIPROP - or must I create an add-on that use requests library to specify proxy?
e.g. http://example.com/live/aaaa/bbbb/file.ts|socks5://1.1.1.1:8080

Please delete this post (or last part thereof if necessary)

@CastagnaIT
Copy link
Collaborator

Note I still had to put the |Origin=https://example.com/ after the manifest otherwise the first HEAD and GET got 403 errors even though after that it still worked. I am a perfectionist so I rather put it this way.

this is also explained on the wiki, in fact you have not set the mimetype on the strm

Just for future reference for people with the same "problem", my final solution was:

for a lack of understanding of how works things,
suggest to do wrong things to users is not so appropriate...

for your last question idk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: External a real bug, but not in the code of this repo
Projects
None yet
Development

No branches or pull requests

2 participants