add-ons / plugin.video.viervijfzes

Kodi add-on to watch video-on-demand content from the Play 4, Play 5 and Play 6 channels.
https://github.com/add-ons/plugin.video.viervijfzes/wiki
GNU General Public License v3.0
50 stars 10 forks source link

Error playing DRM protected episodes #67

Closed MPParsley closed 3 years ago

MPParsley commented 3 years ago

Some episodes of Masterchef (S06E13 and up) result in a failure with the license server.

debug log for S06E12 (plays OK):

2021-02-01 20:08:41.973 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.viervijfzes.content] Fetching episode.video_masterchef-usa_masterchef-usa-seizoen-6_masterchef-usa-s6-aflevering-12.json from cache
2021-02-01 20:08:41.985 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.viervijfzes.auth] Got an id token from memory
2021-02-01 20:08:41.993 T:1777332448  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] Starting new HTTPS connection (1): api.viervijfzes.be:443
2021-02-01 20:08:42.142 T:1777332448  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] https://api.viervijfzes.be:443 "GET /content/81d42571-c55c-442f-b54b-adaf38cbc9ab HTTP/1.1" 200 213
2021-02-01 20:08:42.152 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.modules.player] Resolved stream: {'url': u'https://stream1-vod.cdn1.sbs.prd.telenet-ops.be/geo/MASTERCHEF_USA/S6/volledigeafleveringen/1014696209127352701075259120948694101469/MASTERCHEF_USA_6_12_F0277161/MASTERCHEF_USA_6_12_F0277161.m3u8', 'license_url': None, 'stream_type': u'hls', 'uuid': u'XXX', 'auth': None}
2021-02-01 20:08:42.330 T:1900274608  NOTICE: VideoPlayer::OpenFile: plugin://plugin.video.viervijfzes/play/page/video%2Fmasterchef-usa%2Fmasterchef-usa-seizoen-6%2Fmasterchef-usa-s6-aflevering-12

debug log for S07E02 (doesn't play):

2021-02-01 19:57:48.687 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.viervijfzes.content] Fetching episode.video_masterchef-usa_masterchef-usa-s7_masterchef-usa-s7-aflevering-2.json from cache
2021-02-01 19:57:48.699 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.viervijfzes.auth] Got an id token from memory
2021-02-01 19:57:48.723 T:1777332448  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] Starting new HTTPS connection (1): api.viervijfzes.be:443
2021-02-01 19:57:48.891 T:1777332448  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] https://api.viervijfzes.be:443 "GET /content/e1576059-d49e-4ed7-a5e9-6cace7262713 HTTP/1.1" 200 478
2021-02-01 19:57:48.894 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.viervijfzes.content] Fetching Authentication XML with drm_key XXX
2021-02-01 19:57:48.895 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.viervijfzes.auth] Got an id token from memory
2021-02-01 19:57:48.903 T:1777332448  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] Starting new HTTPS connection (1): api.goplay.be:443
2021-02-01 19:57:49.122 T:1777332448  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] https://api.goplay.be:443 "GET /restricted/decode/XXX HTTP/1.1" 200 2359
2021-02-01 19:57:49.141 T:1777332448  NOTICE: [plugin.video.viervijfzes] [resources.lib.modules.player] Resolved stream: {'url': u'https://stream1-vod.cdn1.sbs.prd.telenet-ops.be/geo/MASTERCHEF_USA/S7/volledigeafleveringen/1014696209196152701075259120250694101469/MASTERCHEF_USA_7_2_F0278565/MASTERCHEF_USA_7_2_F0278565.mpd', 'license_url': u'https://wv-keyos.licensekeyserver.com/', 'stream_type': u'mpd', 'uuid': u'XXX', 'auth': u'XXX'}
2021-02-01 19:57:49.725 T:1777332448  NOTICE: [script.module.inputstreamhelper] Widevine update check was made on 2021-01-22 21:27
2021-02-01 19:57:49.849 T:1900274608  NOTICE: VideoPlayer::OpenFile: plugin://plugin.video.viervijfzes/play/page/video%2Fmasterchef-usa%2Fmasterchef-usa-s7%2Fmasterchef-usa-s7-aflevering-2?channel=None
2021-02-01 19:57:49.852 T:1763201248  NOTICE: Creating InputStream
2021-02-01 19:57:49.885 T:1591693536  NOTICE: [plugin.video.viervijfzes] [resources.lib.service] KodiPlayer onPlayBackStarted
2021-02-01 19:57:50.187 T:1763201248 WARNING: AddOnLog: InputStream Adaptive: Initializing stream with unknown KID!
2021-02-01 19:57:51.347 T:1763201248   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 403
2021-02-01 19:57:51.348 T:1763201248   ERROR: CCurlFile::Open failed with code 403 for https://wv-keyos.licensekeyserver.com/:
2021-02-01 19:57:51.348 T:1763201248   ERROR: AddOnLog: InputStream Adaptive: License server returned failure
2021-02-01 19:57:51.348 T:1763201248   ERROR: AddOnLog: InputStream Adaptive: License update not successful (no keys)
2021-02-01 19:57:51.406 T:1763201248   ERROR: AddOnLog: InputStream Adaptive: Initialize failed (SingleSampleDecrypter)
2021-02-01 19:57:51.409 T:1763201248   ERROR: CVideoPlayer::OpenInputStream - error opening [plugin://plugin.video.viervijfzes/play/page/video%2Fmasterchef-usa%2Fmasterchef-usa-s7%2Fmasterchef-usa-s7-aflevering-2?channel=None]
2021-02-01 19:57:51.409 T:1763201248  NOTICE: CVideoPlayer::OnExit()
2021-02-01 19:57:51.521 T:1900274608  NOTICE: CVideoPlayer::CloseFile()
2021-02-01 19:57:51.521 T:1900274608  NOTICE: VideoPlayer: waiting for threads to exit
2021-02-01 19:57:51.521 T:1900274608  NOTICE: VideoPlayer: finished waiting
2021-02-01 19:57:51.575 T:1591693536  NOTICE: [plugin.video.viervijfzes] [resources.lib.service] KodiPlayer onPlayBackStopped
2021-02-01 19:57:51.591 T:1591693536  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] Starting new HTTPS connection (1): stream1-vod.cdn1.sbs.prd.telenet-ops.be:443
2021-02-01 19:57:51.805 T:1591693536  NOTICE: [plugin.video.viervijfzes] [urllib3.connectionpool] https://stream1-vod.cdn1.sbs.prd.telenet-ops.be:443 "GET /geo/MASTERCHEF_USA/S7/volledigeafleveringen/1014696209196152701075259120250694101469/MASTERCHEF_USA_7_2_F0278565/MASTERCHEF_USA_7_2_F0278565.mpd HTTP/1.1" 200 38758
michaelarnauts commented 3 years ago

This is due to an issue in Inputstream Adaptive, that has already been fixed, but not released unfortunately.

When restarting Kodi, you can play one DRM protected stream, after that, you need to restart again. I'm able to play S07E02 just fine, only once.

See https://github.com/peak3d/inputstream.adaptive/issues/543

MPParsley commented 3 years ago

Thank you @michaelarnauts.

Looks like it was fixed and released for Matrix only.

I tried rebooting but there's no way I can play any of the episodes.

I noticed inputstream adaptive is 2.4.4 while there's a 2.4.6 but when I try to update I get the message that there are no updates.

michaelarnauts commented 3 years ago

You could try an Inputstream version that was linked in the VTM Go issue. I think those also have this fix.

michaelarnauts commented 3 years ago

See here: https://github.com/add-ons/plugin.video.vtm.go/issues/241

I think these versions have that fix.

MPParsley commented 3 years ago

Thanks for the link. Tried the 2.4.6.1 version there but the issue remains.

Are you sure this is the same issue? In the logs I see that one episode returns a drm license_url and the other doesn't. It's the one that returns a license url that fails with a http 403. I can play Netflix episodes so DRM/widevine seems to be working.

Could there be some sort of caching in play?

michaelarnauts commented 3 years ago

@MPParsley i see the ?channel=None in your log now. This might be the cause, but it is already fixed in the latest master branch. Can you try installing that? I think you will still need the updated inputstream adaptive to play DRM protected content more then once.

MPParsley commented 3 years ago

Hi @michaelarnauts, I installed:

Did a fresh restart but no luck.

2021-02-02 20:56:20.107 T:1257230560  NOTICE: [script.module.inputstreamhelper] Widevine update check was made on 2021-01-22 21:27
2021-02-02 20:56:20.308 T:1900168112  NOTICE: VideoPlayer::OpenFile: plugin://plugin.video.viervijfzes/play/page/video%2Fmasterchef-usa%2Fmasterchef-usa-seizoen-6%2Fmasterchef-usa-s6-aflevering-18
2021-02-02 20:56:20.309 T:1762808032  NOTICE: Creating InputStream
2021-02-02 20:56:20.353 T:1583317216  NOTICE: [plugin.video.viervijfzes] [resources.lib.service] KodiPlayer onPlayBackStarted
2021-02-02 20:56:20.607 T:1762808032 WARNING: AddOnLog: InputStream Adaptive: Initializing stream with unknown KID!
2021-02-02 20:56:21.843 T:1762808032   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 403
2021-02-02 20:56:21.843 T:1762808032   ERROR: CCurlFile::Open failed with code 403 for https://wv-keyos.licensekeyserver.com/:
2021-02-02 20:56:21.844 T:1762808032   ERROR: AddOnLog: InputStream Adaptive: License server returned failure
2021-02-02 20:56:21.844 T:1762808032   ERROR: AddOnLog: InputStream Adaptive: License update not successful (no keys)
2021-02-02 20:56:21.903 T:1762808032   ERROR: AddOnLog: InputStream Adaptive: Initialize failed (SingleSampleDecrypter)

?channel=None no longer appears in the logs but I still get a 403 on the license url. I tried creating a new account but still no luck.

MPParsley commented 3 years ago

@michaelarnauts, there's no KID or default_KID in the mpd file:

<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:cenc="urn:mpeg:cenc:2013" xmlns:dvb="urn:dvb:dash-extensions:2014-1" xmlns:mspr="urn:microsoft:playready" xmlns:scte35="http://www.scte.org/schemas/35/2016" id="MASTERCHEF_USA_7_2_F0278565" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT2315.541S" minBufferTime="PT10.000S" maxSegmentDuration="PT10.000S">
   <Period id="Period1">
      <AdaptationSet group="1">
         <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" />
         <ContentProtection schemeIdUri="urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" value="cenc">
            <cenc:pssh>XXX</cenc:pssh>
         </ContentProtection>
         <ContentProtection schemeIdUri="urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" value="MSPR 2.0">
            <cenc:pssh>XXX</cenc:pssh>
            <mspr:pro>XXX</mspr:pro>
         </ContentProtection>

Looking at the proxy patch, all the tests expect a default_KID value and uuid values seem to be missing "-":

<ContentProtection value="cenc" schemeIdUri="urn:mpeg:dash:mp4protection:2011" cenc:default_KID="0d3737f13c4e1c75b017d99621eb4be0"/>

Clients SHALL provide all default_KIDs of the selected adaptation sets to the DRM system during activation and SHALL NOT assume that activating a DRM system with one content key will implicitly enable the use of any other content key.

source: https://dashif-documents.azurewebsites.net/Guidelines-Security/master/Guidelines-Security.html#CPS-default_KID

  1. Is the fact that there isn't a default_KID in the manifest a bug on the side of the provider?
  2. OR is the wrong segment being used to init?

Diving deeper in the code, I'd say IA should use the init segment to do DRM-specific initialization (instead of the default_KID id)?

<SegmentTemplate timescale="25" media="video/1600/segment-$Time$.mp4" initialization="video/1600/segment-init.mp4">
MPParsley commented 3 years ago

So I have

@MPParsley I think this is related to this: #543 (comment)

It should be fixed by this commit: 30f3a74

@michaelarnauts, I think https://github.com/peak3d/inputstream.adaptive/commit/30f3a74595fb6e33d871c5aac0df703a2c9a240c was committed to Leia so it should be part of the 2.4.6.1a proxy so this could be another bug or am I missing something here?

michaelarnauts commented 3 years ago

You probably want the latest master of GoPlay. The build of IA of the vtm.go proxy issue should Indeed contain the fix I was referring to. But even without that fix, I was able to play one stream just find.

I've send you a message on FB with a Slack invite. I hope to troubleshoot this together.

michaelarnauts commented 3 years ago

See #69