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

Request to License Server not correct - License server returned failure under Linux #1041

Closed
6 tasks
spacys opened this issue Sep 18, 2022 · 31 comments
Closed
6 tasks
Labels
Issue Cleanup: Closed Issue closed as part of cleanup exercise.

Comments

@spacys
Copy link

spacys commented Sep 18, 2022

Bug report

Describe the bug

I've developed an Amazon Media Plugin and this is working since long under Windows and Linux. But since few weeks the License server is returning failure under Linux. After 30 seconds the stream stopped and jump to the next song. The log file from Windows is showing this:
CurlFile::Open(0x2138edd0180) https://music.amazon.de/EU/api/dmls/
XCURL::DllLibCurlGlobal::easy_acquire - Created session to https://music.amazon.de

and from Linux:
CCurlFile::FillBuffer - Failed: HTTP returned error 400
CCurlFile::Open failed with code 400 for https://music.amazon.de/EU/api/dmls/:

for the same request.
I've checked the behavior with the same Kodi, IA and Addon version on Windows and Linux.

Expected Behavior

Create successful session to the Amazon server to get the License keys.

Actual Behavior

Session creation returning error 400

Possible Fix

I assume a different behavior of the curl versions between Windows and Linux or the way how IA is forwarding the token information to those libraries. Specially in regards to mask special characters.

To Reproduce

Steps to reproduce the behavior:

  1. Install the Addon
  2. Logon to Amazon (a Amazon Prime Account is necessary)
  3. Play one of the available songs

Debuglog

The debuglog can be found here:
Request header is:

DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Accept: application/json, text/javascript, */*; q=0.01'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Accept-Encoding: gzip, deflate'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Accept-Language: de,en-US,en;q=0.9'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Content-Encoding: amz-1.0'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Content-Type: application/json'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Expect: '
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Host: music.amazon.de'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Origin: https://music.amazon.de'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'X-Amz-Target: com.amazon.digitalmusiclocator.DigitalMusicLocatorServiceExternal.getLicenseForPlaybackV2'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'X-Requested-With: XMLHttpRequest'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'csrf-rnd: <token replaced>'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'csrf-token: <token replaced>'
DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'csrf-ts: <token replaced>'

MPD/M3U8s/ISM

An example or copy of a manifest (or manifests for HLS - master and variants) can be found here:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MPD minBufferTime="PT10S" type="static" mediaPresentationDuration="PT3M2.275S" profiles="urn:mpeg:dash:profile:isoff-live:2011" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:amz-music="urn:amazon:music:drm:2019" xmlns:cenc="urn:mpeg:cenc:2013" xmlns:mspr="urn:microsoft:playready">
    <Period>
        <AdaptationSet segmentAlignment="true" mimeType="audio/mp4" startWithSAP="1">
            <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" cenc:default_KID="e416ec4c-ba9b-e09e-75c1-c263d0821a2f" value="cenc"/>
            <ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95" value="2.0">
                <mspr:pro>gAIAAAEAAQB2AjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AVABPAHcAVwA1AEoAdQA2AG4AdQBCADEAdwBjAEoAagAwAEkASQBhAEwAdwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBpAC8AYwB1AEQAMgAxAHIATwBJAGMAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBtAHUAcwBpAGMALgBhAG0AYQB6AG8AbgAuAGMAbwBtAC8AZABtAGwAcwAvAGEAYwBxAHUAaQByAGUATABpAGMAZQBuAHMAZQA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</mspr:pro>
                <cenc:pssh>AAACoHBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAoCAAgAAAQABAHYCPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBUAE8AdwBXADUASgB1ADYAbgB1AEIAMQB3AGMASgBqADAASQBJAGEATAB3AD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+AGkALwBjAHUARAAyADEAcgBPAEkAYwA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAG0AdQBzAGkAYwAuAGEAbQBhAHoAbwBuAC4AYwBvAG0ALwBkAG0AbABzAC8AYQBjAHEAdQBpAHIAZQBMAGkAYwBlAG4AcwBlADwALwBMAEEAXwBVAFIATAA+ADwALwBEAEEAVABBAD4APAAvAFcAUgBNAEgARQBBAEQARQBSAD4A</cenc:pssh>
            </ContentProtection>
            <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
                <cenc:pssh>AAAAZnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAEYIARIQ5BbsTLqb4J51wcJj0IIaLxoLQW1hem9uTXVzaWMiHGNpZDo1QmJzVExxYjRKNTF3Y0pqMElJYUx3PT0qBUFVRElP</cenc:pssh>
            </ContentProtection>
            <Representation id="256kbps" bitrate="256" codecs="mp4a.40.2" audioSamplingRate="44100" bandwidth="257461">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
                <SegmentList timescale="1000" duration="10000">
                    <Initialization sourceURL="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/cd8b10f1-a490-39f5-8376-cd2748d700a6.mp4?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/52bb6ae4-b4f9-3512-9094-1e6983757065.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/a58c1cb8-ee09-3f77-a0b4-6bf9ff15df35.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/767226f2-1156-3648-b3c0-a040daf83435.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/ea97c3ff-8049-39c5-a5f4-2c2ce445712f.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/f4819184-4bb1-3db6-b861-4e49d5770f4c.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/86db0a22-9f7b-3240-86c0-afba6eb0dbf1.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/e68a77d3-68c4-3170-acb6-1cbceca2246b.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/39ca3638-026f-3d94-acb1-569ce0c453cd.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/7d9706cc-02bc-349c-b05c-798a463f26e3.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/506c857c-f12a-32c2-a93b-42d87cca31d8.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/5724c555-68cd-3e2e-bb49-0144bb3853ba.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/853b3b69-2319-3407-b5ef-b0d699f8abce.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/db0bc9e5-e1de-359e-a336-47e5788b4070.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/881b0d73-728b-3b3c-96cf-62540885f234.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/da57cbc9-c7e6-366a-ba0f-e1a888afe7d0.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/b5c01ff6-210b-3f0e-a0ec-08617f2d72d8.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/4ed1b78b-dd04-38bc-92d5-2f48f376e8d5.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/2d9b62bd-9538-3a46-b2b8-30d46e48ef59.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                    <SegmentURL media="https://dfqzuzzcqflbd.cloudfront.net/93159ea3-4200000305651674/ac52ba27-0533-3be2-aaa5-d22db921260e.m4s?r=5701059f-fd82-474d-987b-2a2cec0dae36&amp;rs=EU&amp;mt=DE"/>
                </SegmentList>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

Screenshots

Here are some links or screenshots to help explain the problem:

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

Your Environment

Used Operating system:

  • Android

  • iOS

  • tvOS

  • [ X ] Linux

  • OSX

  • Windows

  • Windows UWP

  • Operating system version/name: Linux Mint 20.3 Cinnamon / Ubuntu 22.04.

  • Kodi version: 19.4.0

  • inputstream.adaptive version: 19.0.7

note: Once the issue is made we require you to update it with new information should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

@glennguy
Copy link
Contributor

Log snippets aren't any good to us.

For example we would be able to see which CDM version is being used from the log and possibly other useful information.

inputstream.adaptive sends the request, but the payload of the request is created by the CDM which differs from Windows to Linux. Please check in your log with cURL component logging turned on, from memory you can see the response included with the 400 error.

@spacys
Copy link
Author

spacys commented Sep 18, 2022

Thanks for the quick response.
I've checked the component log, the error message is "Bad Request", nothing else. Compared as well header in/out is the same.
The CDM version is: 4.10.2449.0 ...is the same version like Windows
Attached the 'normal' debug log from Linux. kodi.log

@glennguy
Copy link
Contributor

Can you have a look with cURL component debugging turned on?

For me I get to see the content in the server response e.g INVALID_LICENSE_CHALLENGE:

2022-09-20 23:02:44.429 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: HTTP/2 500 
2022-09-20 23:02:44.429 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: content-type: text/html; charset=utf-8
2022-09-20 23:02:44.429 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: cache-control: no-cache
2022-09-20 23:02:44.429 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: access-control-allow-origin: *
2022-09-20 23:02:44.429 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: x-cloud-trace-context: ebf8442316b14fbf7d75418ac90c27bb
2022-09-20 23:02:44.429 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: date: Tue, 20 Sep 2022 13:02:46 GMT
2022-09-20 23:02:44.430 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: server: Google Frontend
2022-09-20 23:02:44.430 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: content-length: 25
2022-09-20 23:02:44.430 T:26580   DEBUG <general>: Curl::Debug - HEADER_IN: alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
2022-09-20 23:02:44.430 T:26580   DEBUG <general>: Curl::Debug - SSL_DATA_IN: ��� 3
2022-09-20 23:02:44.430 T:26580   DEBUG <general>: Curl::Debug - SSL_DATA_IN: �
2022-09-20 23:02:44.430 T:26580   DEBUG <general>: Curl::Debug - SSL_DATA_IN: ��� �
2022-09-20 23:02:44.431 T:26580   DEBUG <general>: Curl::Debug - SSL_DATA_IN: �
2022-09-20 23:02:44.431 T:26580   DEBUG <general>: Curl::Debug - TEXT: Connection #0 to host cwip-shaka-proxy.appspot.com left intact
2022-09-20 23:02:44.431 T:26580   ERROR <general>: CCurlFile::XFILE::CCurlFile::Open - <https://cwip-shaka-proxy.appspot.com/no_auth> Failed with code 500:
                                                   INVALID_LICENSE_CHALLENGE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
2022-09-20 23:02:44.431 T:26580   ERROR <general>: AddOnLog: inputstream.adaptive: License server returned failure

@spacys
Copy link
Author

spacys commented Sep 20, 2022

Sure, it needs to be executed from the addon with the Amazon server behind.

2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: HTTP/1.1 400 Bad Request
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Server: Server
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Date: Tue, 20 Sep 2022 14:35:55 GMT
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Content-Type: application/json
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Content-Length: 321
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Connection: keep-alive
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: x-amz-rid: NAA6VWY8M1AJMS5QHSEP
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: x-amzn-RequestId: 98a95618-3b00-4b1e-acf4-c08233590496
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Access-Control-Allow-Origin: https://music.amazon.de
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Access-Control-Expose-Headers: x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Access-Control-Allow-Credentials: true
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Vary: Origin,Content-Type,Accept-Encoding,User-Agent
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - HEADER_IN: Strict-Transport-Security: max-age=47474747; includeSubDomains; preload
2022-09-20 16:35:55.530 T:2368    DEBUG <general>: Curl::Debug - TEXT: Connection #0 to host music.amazon.de left intact
2022-09-20 16:35:55.530 T:2368    ERROR <general>: CCurlFile::Open failed with code 400 for https://music.amazon.de/EU/api/dmls/:
                                                   {"__type":"com.amazon.digitalmusiclocator#ForbiddenException","denialReason":"CONTENT_NOT_ELIGIBLE","message":"content not eligible (EligibilityException CONTENT_NOT_ELIGIBLE) request-id: 98a95618-3b00-4b1e-acf4-c08233590496 music-agent: Maestro/1.0 WebCP/1.0.202638.0","requestId":"98a95618-3b00-4b1e-acf4-c08233590496"}
2022-09-20 16:35:55.530 T:2368    ERROR <general>: AddOnLog: inputstream.adaptive: License server returned failure

@glennguy
Copy link
Contributor

@spacys please see here: https://in.amazonforum.com/s/question/0D56Q00009mJwk1SAC/getting-playback-error-while-playing-music-from-browsers-in-linux

Amazon are not currently accepting license requests from x86_64 linux CDMs. Maybe worth trying on an ARM device to see if that is blocked too. In any case the issue is not with inputstream.adaptive.

@spacys
Copy link
Author

spacys commented Sep 21, 2022

Good finding...I've tried with Chrome browser and it is working under Ubuntu. Looks the issue above is only related to India, but I'm not sure.
What makes you that confident that this has nothing to do with IA?

@glennguy
Copy link
Contributor

I can only suggest then if it works in ubuntu chrome to compare the headers etc in Chrome vs. Kodi in Linux.

What makes you that confident that this has nothing to do with IA?

The combination of this being the only service we've heard of having this issue recently, and the contents of the error response "denialReason":"CONTENT_NOT_ELIGIBLE" indicating that the request itself is fine, just that issuing a license for that particular content is denied due to being 'ineligible'. Happy to be wrong on this but I can't foresee how any changes on IA side would make content 'eligible'.

@spacys
Copy link
Author

spacys commented Sep 22, 2022

The addon is doing exactly the same on Linux and as well on Windows, so there are no different code snippets or OS switches.
The addon is calling IA, and IA is using different libraries for Windows and Linux. If you can confirm IA is doing exactly the same things on Windows and Linux, then I would say it has something to do with the used Linux library. Or am I wrong?

@spacys
Copy link
Author

spacys commented Oct 1, 2022

Do you have any updates for me?

@glennguy
Copy link
Contributor

glennguy commented Oct 1, 2022

If you can confirm IA is doing exactly the same things on Windows and Linux

Yes this is correct. We can't control how the WV proxy responds to the request. I don't know the state of Verified Media Path in Linux browsers. I wonder if you used a different browser (even one that you compile yourself) if it would still play. VMP is (AFAIK) something that can be enforced per platform. Do you have a RPi or similar to try Linux ARM?

then I would say it has something to do with the used Linux library

Not necessarily, like I said I believe that providers can configure different rules for different platforms.

Another way to check if VMP is enabled in Chrome/Ubuntu is to check for a POST request with x08x04 (sometimes base64 encoded, something like CAQ= ). This is the CDM asking for a certificate to check against the browser. If this is the case then it would explain why Kodi won't work.

@spacys
Copy link
Author

spacys commented Oct 8, 2022

I think, I've found the root cause and identified another issue.
IA expect data in this format (req | header | body | response)
Now the body contains a Bearer token. This token includes this sign |, but IA is interpreting it as the next data block.
ERROR <general>: AddOnLog: inputstream.adaptive: 4 '|' separated blocks in licURL expected (req / header / body / response)

Means the content of body needs to be encapsulated. Is there a chance to do it already, like body send as base64 encoded string? Or is an adjustment of IA necessary?

@CastagnaIT
Copy link
Collaborator

the "body" so post data to prevent characters problem can be set data as url encoded

@spacys
Copy link
Author

spacys commented Oct 22, 2022

Does IA automatically decoding the body to send data in the right format? How is IA recognizing it or is an additional flag necessary? It is not my aim to send encoded data to the Amazon API.

@glennguy
Copy link
Contributor

Can you put an example here for us to see? Would be much easier to understand and help you fix

@CastagnaIT
Copy link
Collaborator

just check because i dont remember exactly,
so ISA URL decode the "body" data only if first char of data is a % percentage
then if your | char is in the middle of the data string the "body" will not be URL decoded
can you attach an example?

in case we could make a change to determine when force URL decoding

@spacys
Copy link
Author

spacys commented Oct 23, 2022

Thanks for your support...highly appreciated.
The body looks like this:

{
    "DrmType": "WIDEVINE",
    "customerId": "<customerId>",
    "deviceToken": {
        "deviceTypeId": "<deviceTypeId>",
        "deviceId": "<deviceId>"
    },
    "appInfo": {
        "musicAgent": "Maestro/1.0 WebCP/1.0.202638.0 (ea3a-4e8b-dmcp-132f-bdccb)"
    },
    "Authorization": "Bearer <token with | in it >",
    "licenseChallenge": "b{SSM}"
}

The creation of this JSON can be found here, starting at line 647. Please consider, the Authorization with Bearer token is currently not merged with the master branch and just locally available.
Preparation for IA is here, starting at line 91 and the License Key at line 136. licBody contains the JSON above.

@CastagnaIT
Copy link
Collaborator

in this case should be no problem because you dumps json that when URL encoded the string will starts always with %
you should do something like:

body_data = urllib.parse.quote(json.dumps(dict_data))

sending will be handled correctly since ISA URL decode it internally

@mkorganashvili
Copy link

@spacys did it work for you?
I have a problem with linux but I don't think it is because of the symbol or smth

@spacys
Copy link
Author

spacys commented Dec 22, 2022

I incorporated and tested the suggested changes, but there is no difference. Still the same behavior with same error messages.
Either Amazon has really switched off the Linux support or it is related to the used libraries or other dependencies.
The same code runs under Windows without issues, only with Linux I'm facing the issues, but the same code was working before under Linux.
Currently, I've no idea how to analyze it further and how to resolve this issue.

@leGeddy
Copy link

leGeddy commented Dec 23, 2022

Here's a comparison between Android TV and Linux using Amazon Music addon (logs edited for brevity):

Works on Android TV (info from InputStream Helper):

Kodi version 19.3 is running on a Android system with arm architecture.
InputStream Helper is at version 0.5.10+matrix.1
InputStream Adaptive is at version 19.0.7
Widevine CDM is built into Android

Log:
android.txt

Does not work on Linux (info from InputStream Helper):

Kodi version 19.4 is running on a Linux system with x86_64 architecture.
InputStream Helper is at version 0.5.10+matrix.1
InputStream Adaptive is at version 19.0.3
Widevine CDM is at version 4.10.2557.0 and was installed on 2022-12-15 15:06

Log:
Linux.txt

Hope this helps and sorry if I did not do this correctly ;)

@glennguy
Copy link
Contributor

Hi @leGeddy thanks for the logs.

The next step for analysis would be confirming whether the service will run in a browser not signed for Widevine VMP. Maybe one of the smaller Firefox forks? Normally a license request from a signed browser will include a certificate and the payload is much larger (eg. ~6000 bytes vs ~1800) and this can help determine if it's VMP capable or not. If it works in such a browser under x64 linux then there's most likely something that can be done in the addon to send the 'right' request.

@spacys
Copy link
Author

spacys commented Dec 30, 2022

No certificate is requested. I assume VMP is not activated, and if so why for Linux only?!? With Kodi on Windows it is working. The issue is, Amazon has redesigned their whole web pages incl. the process how to generate calls. Means, it cannot be tested with a browser any longer. Nevertheless the 'old' API's are still working.

@leGeddy
Copy link

leGeddy commented Dec 30, 2022

I should mention the Amazon VOD addon does work on Kodi Linux. Worth investigating.

@spacys
Copy link
Author

spacys commented Dec 31, 2022

@leGeddy, I know but this addon is working differently and does not have API's. They are creating URL requests, similar to user activities with the browser.
Amazon has two different code structures behind, one for Amazon Music and the other one for Amazon VOD.

@leGeddy
Copy link

leGeddy commented Dec 31, 2022

Alright then, never mind ;)
Seems Amazon do everything they can to not make it simple...

@spacys
Copy link
Author

spacys commented Jan 2, 2023

At least, they does not have a clear API strategy and of course, they are not open for any third party activities. It would be that easy to provide cool API's with clear authentication...
Till then, we need to investigate the current issue and hopefully we are able to identify the root cause. @glennguy is there a way to log the real requests to Amazon out of IA? With that one we could compare them between Windows and Linux and maybe we can see something.

@glennguy
Copy link
Contributor

glennguy commented Jan 5, 2023

@spacys yes there is, just need to undo the changes in this PR #770

You could try this tool: https://tools.axinom.com/decoders/LicenseRequest

@spacys
Copy link
Author

spacys commented Jan 5, 2023

I need some guidance...I've <UID>.challenge and <UID>.init files in the cdm folder, both are binary files. How can I post the content to the tool you have provided?
I've compared the manifest.json between Windows and Linux. Apart from the OS identifier is the property x-cdm-persistent-license-support set to true on Windows and false on Linux. Not sure if this is relevant.

@glennguy
Copy link
Contributor

glennguy commented Jan 5, 2023

We don't use persistent storage so that part shouldn't matter.
Try converting the binary file to base64 and see if the tool will take it in that format

@spacys
Copy link
Author

spacys commented Jan 11, 2023

I did this conversion and compared the results. The domain above is able to read the base64 content, good thing. The output looks quite similar except this one:
Windows file

HDCP supported
Support for HDCP (High-bandwidth Digital Content Protection). This client supports HDCP versions up to (including) 1.x.

Linux file

HDCP unknown
Support for HDCP (High-bandwidth Digital Content Protection).

Both files were created on the same physical computer. OS switch via boot loader.

@CastagnaIT CastagnaIT added the Issue Cleanup: Closed Issue closed as part of cleanup exercise. label Jul 25, 2023
@CastagnaIT
Copy link
Collaborator

after 1 year we cant provide you a solution for your service
i think it is time to close

@CastagnaIT CastagnaIT closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue Cleanup: Closed Issue closed as part of cleanup exercise.
Projects
None yet
Development

No branches or pull requests

5 participants