emilsvennesson / kodi-viaplay

Viaplay for Kodi
GNU General Public License v3.0
30 stars 19 forks source link

MPEG-DASH (inputstream.adaptive) and Widevine CDM #9

Closed emilsvennesson closed 7 years ago

emilsvennesson commented 7 years ago

As discussed in #7, Viaplay has started to implement FairPlay DRM on their sports content -- a DRM technology only supported on Apple devices. This is probably going to spread and eventually affect all content, which means that a move away from HLS is inevitable in order for this project to live on.

Viaplay is using MPEG-DASH with Widevine encryption on Google Chrome as well as the Android platform. This is somewhat good news, because it /should/ be possible to implement in a similar way to the Netflix (https://github.com/asciidisco/plugin.video.netflix) and Sky Go (https://github.com/trummerjo/plugin.video.skygo) add-ons. This is however rather poorly documented and there is not a lot of add-ons using this method to take inspiration from.

I have done some testing but haven't yet been able to figure it out. It's easy to get the MPEG-DASH manifests from the Viaplay API by using 'pcdash' as deviceKey (see https://github.com/emilsvennesson/kodi-viaplay/blob/master/resources/lib/vialib.py#L124). The API will then return an .mpd manifest along with a templated URL for the request to the Widevine license server. However, an additional parameter called '_widevineChallenge' is required to complete the license request that I can't for my life figure out how to generate.

I'd happily take any help or pointers on this. Feel free to hit me up on #kodi-dev at freenode or by simply responding to this issue. :-)

emilsvennesson commented 7 years ago

Well, it turns out that _widevineChallenge is just a base64-encoded string of the challenge that's being generated by the Widevine binary. I am trying to get in touch with @peak3d to iron out some issues regarding the MPD format Viaplay uses.

rikardfries commented 7 years ago

Hi, I do run the Magine addon on my kodi and have had great help from several people at k.n. to get it running. It is not easy to setup but there are descriptions on their webpages. I do not have viaplay but would be very interested interested in running/testing the cmore addon.

peak3d commented 7 years ago

@emilsvennesson:

emilsvennesson commented 7 years ago

@peak3d Hi and thanks for the comprehensive reply! I have tried this but no matter what I try, I can't seem to get inputstream.adaptive to send any challenge to the license server. Instead, it tries to play the stream which obviously fails because it is encrypted.

I've also tried with another service (C More) and that works fine, so my guess is that there's some parsing issue with the manifest used my Viaplay that causes it to not detect the encryption properly. I've also tried with kodi-agile and unfortunately it's still behaving the same way there.

Sample MPD format: https://pastebin.com/0j34fQJL kodi.log on playback attempt: https://pastebin.com/xguBtWs4

Thanks in advance for looking into this!

peak3d commented 7 years ago

Yes, you are right, there are 2 issues, one of them is that ContentProtection is currently not supported in representations what leads to the assumption that the stream is not encrypted.

B.t.w: Playready is not supported from looking into the encryption header, only widevine.

emilsvennesson commented 7 years ago

@peak3d Ah, I see. Is this something you expect to add support for in the future? :-) Also, would you please care to elaborate what you mean with that only Widevine is supported? When inspecting from Chrome, it's definitely encrypted with Widevine as it's requesting and obtaining the license from a Widevine server.

Regarding the inputstream.adaptive.license_key format: I'm going to have to send a JSON-formatted POST request. Here's a sample:

POST /wv/web/ModularDrm?form=json&schema=1.0&httpError=false&token=[EDITED OUT]&account=[EDITED OUT]  HTTP/1.1
Host: widevine.entitlement.theplatform.eu
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Length: 2439
Content-Type: text/plain;charset=UTF-8
Origin: https://viaplay.se
Connection: keep-alive

{"getWidevineLicense":{"releasePid":"6_0yhib9WXpY","widevineChallenge":"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"}}

releasePid is easily obtained from their API when requesting the stream and widevineChallenge is the challenge base64-encoded.

Sample response:

{
    "getWidevineLicenseResponse": {
        "license": "CAISvAMKKgoQ8NeL7tlU1TbNzdbH8qRoAhIQ8NeL7tlU1TbNzdbH8qRoAhoAIAEoABIoCAEQARgBKAAw/5meAUIZbnVsbC9yZW5ld1dpZGV2aW5lTGljZW5zZRpmEhByRpRLoFQ2fzazJdWw1T7dGlAjgSe0cZR68dOxqT0PXYZoqdoGbfFzhl3ujp+bGyU1SEXjhPmNFw9GpQKMSb2r+BV6FXEBfXEix9iFqap5b40kPc+5gHVFJ2gx15uWSGlFYSABGkoKEAgSfOEOIlDemBsLYhukGVcSEFaTN9GEbUqtgi7QEFTzWi8aIIV/uUsn8XP2zhXTglaVLlPsRCvU03l8fFpaTNnbJFwsIAIoARpKChChB6Rm1bVaKrQBgcbzPnfBEhAvJ9hNq6HFnqNecLFRynJfGiCvQjhjSsvhv1PNkftOkXno435vDOhhPfLXK2hHunOv9iACKAEaSgoQ9UhMjnrJWy2ic8eDyVsNVBIQzDd2eGJNLnebT8qZ1mYGFBogQqi0HBtUpb0wNZ5r1pZHOr1K4kj5Zu1wShLVsXEQZkUgAigBIIW0+ccFOOPclZsGQgxIRENQREFUQQAAAAEaIMq/J/Jgfcg6T7SwZ1cA06RnT1FdDVtdmGkQ6ZuNeebJIoACn0R7pL8h/4+OIcHkMXv8RXkWlviG4AWgr/uZRx1O724L8vE9o9ugGXU/gRgMT4VECeBxOKGRXfnQ7xvhWUdEEs/+fV2VoG3KSoBs2ckS3hZMfL82RiFvBpOkx/vyVQklVIcWd/QLxE8szLC3alpTqUqGHAelQr4G5sleIK5OOsTLVvb8a8JIKyCcTxCOKsd5YNPEx1TIJf+V8cYXzEYOSMPaExKNuGX/1CwJEQuwZl66k9TkqVAnzFZEMa5WG7eBDnGkMJ+152UcdkuASssw9RABmlqOP4SWtQhxWA4EbjJn9dkjf2EG/JPbv3DtQX+h0Z9P+lSfXv5uOaGs99QIcQ=="
    }
}
peak3d commented 7 years ago

In general inside mp4 container MOOV section you find license information for playready and widevine (because most content provider support both), this can be found in general also in the mpd manifest (wich is not true here, in your mpd manifest there is no hint what type of encryption is supported / required, one has to look into the stream itself)

This note is only to let you know that it is impossible to decrypt the stream with playready drm, only widevine is possible.

Yes, sure, I'll look at it in the next days

emilsvennesson commented 7 years ago

@peak3d Great! Thanks a lot. :-)

Do you think something like this would work for the format:

def format_license_post_data(releasePid, wv_challenge):
    post_data = {
        'getWidevineLicense': {
            'releasePid': releasePid,
            'widevineChallenge': base64.b64encode(wv_challenge)
        }
    }

    return json.dumps(post_data)

playitem.setProperty('inputstream.adaptive.license_key', LICENSE_URL + '||' + format_license_post_data(releasePid, 'R{SSM}') + '|'WHERE_TO_FIND_RESPONSE')

I'm not quite sure how to format the WHERE_TO_FIND_RESPONSE. part though.

peak3d commented 7 years ago
def format_license_post_data(releasePid, wv_challenge):
    post_data = {
        'getWidevineLicense': {
            'releasePid': releasePid,
            'widevineChallenge': wv_challenge
        }
    }

    return json.dumps(post_data)

playitem.setProperty('inputstream.adaptive.license_key', LICENSE_URL + '||' + format_license_post_data(releasePid, 'B{SSM}') + '|JBlicense')

Edit:

https://github.com/liberty-developer/inputstream.adaptive/blob/master/wvdecrypter/wvdecrypter.cpp#L289

This is the part where the template string is exploded and processed, its not too much to read from source there.

emilsvennesson commented 7 years ago

@peak3d Thank you!

emilsvennesson commented 7 years ago

@peak3d So I tried calling this function within the setProperty for another add-on, but it doesn't actually pass the challenge to the function and instead simply gives me ' 'B{SSM}' as a string.

I have worked around this by writing a simple proxy that deals with the communication with the real license server, but it would have been nice to be able to get the challenge data before sending it to the license server somehow.

emilsvennesson commented 7 years ago

@rikardfries I've published the code on https://github.com/emilsvennesson/kodi-cmore. Note that you'll need inputstream.adaptive from the agile branch for live streams to work properly.

@peak3d Have you had any chance to look at this yet?

peak3d commented 7 years ago

@emilsvennesson should be possible tonight

emilsvennesson commented 7 years ago

@peak3d Awesome! I'm looking forward to testing it out. :-)

tynor88 commented 7 years ago

Hi, let me know if you need some help with testing. Just found the plugin and I'm eager to get the sport playback working (y)

PlaceboPRS commented 7 years ago

Would also be happy to test, if the addon can't work with Viaplay then I'll be cancelling my Viaplay membership as football playback through their Android app is utter garbage.

emilsvennesson commented 7 years ago

@peak3d I retried this today on the agile branch but I'm still seeing the same thing. I guess it's still a WIP or should I hit you up with a new log?

peak3d commented 7 years ago

@emilsvennesson can you pls. pastebinit the mpd file again? The initial link is not valid anymore. sorry for the delay, the backport agile -> mainline cost a lot of time currently.

emilsvennesson commented 7 years ago

@peak3d Ah, no worries! I know you have a lot on your plate. :-)

Here's the MPD: https://pastebin.com/mrp8S804

peak3d commented 7 years ago

@emilsvennesson

I have worked around this by writing a simple proxy that deals with the communication with the real >license server, but it would have been nice to be able to get the challenge data before sending it to the >license server somehow.

why^^? something missing n the template? The challenge is only valid for this single call. The next time you request a license the challenge differs.

beside this I added some code for ConenProtection in Representation. Has to be tested.

emilsvennesson commented 7 years ago

@peak3d I'm not able to process the Widevine challenge directly in Python, because if I call the function like this: playitem.setProperty('inputstream.adaptive.license_key', LICENSE_URL + '||' + format_license_post_data(releasePid, 'B{SSM}') + '|JBlicense') wv_challenge in the format_license_post_data function gives me 'B{SSM}' rather than the actual challenge.

Big thanks! I am going to test it out and report back to you!

peak3d commented 7 years ago

But you should really not think about a proxy server only because there is somewhere a small issue solved in a few minutes. I don't understand why you want to deal with the challenge, the challenge is send internally (libssd_wv) to the license server and you don't have to do any python call for this.

Pls. print out in python what "LICENSE_URL + '||' + format_license_post_data(releasePid, 'B{SSM}') + '|JBlicense'" results to.

emilsvennesson commented 7 years ago

@peak3d This is with https://github.com/emilsvennesson/kodi-viaplay/commit/098a50f513e4144c09e582e312d5632f45b5a817 (format_license_data prints out the release_pid and challenge)

22:53:05.329 T:140623185172224   DEBUG: [Viaplay]: release_pid: iN46_8dFI_YU
22:53:05.329 T:140623185172224   DEBUG: [Viaplay]: wv_challenge: B{SSM}
peak3d commented 7 years ago

inputstream.adaptive.license_key is a property attached to the mpd file you pass to kodi / inputstream.adaptive.

B{SSM} will be evaluated in inputstream.adaptive, its a placeholder like %i in a format string. inputstream.adaptive / libssd_wv will fill the placehlders with the real data and make the license request.

Again, you don't have to deal with the challenge, its all done automagically in inputstream.adaptive. Simply send the manifest URL with the 3 required listItem properties nd you are done.

Edit: playitem.setProperty('inputstream.adaptive.manifest_type', 'mpd') is mising

emilsvennesson commented 7 years ago

@peak3d But what if I have to format the POST data in the challenge request ike it's done in format_license_post_data -- otherwise the server won't recognize it?

I tried with the latest commit in the agile branch and I'm getting an 'Unable to handle decryption. Unsupported!' message in the log now.

kodi.log: https://pastebin.com/rBQNiuTV mpd file: https://pastebin.com/kthbjPyM

Edit: Yeah, I forgot to add those in the commit. Thanks!

peak3d commented 7 years ago

playitem.setProperty('inputstream.adaptive.license_key', LICENSE_URL + '||' + "{ 'getWidevineLicense': { 'releasePid': releasePid, 'widevineChallenge': 'B{SSM}' } }" + '|JBlicense')

something like this, there may be missing some " and + but this^^ is it from concept.

"Unable to handle decryption. Unsupported" is a bug on my side, I'll look for it Edit: pushed the changes (inputstream.adaptive / peak3d repo

emilsvennesson commented 7 years ago

@peak3d I feel like we're really close now! I'm getting a successful license request, but for some reason inputstream.adaptive fails to find the license in the JSON string. Here's the log snippet: https://pastebin.com/b5TUBsiq

This is the response from the license server:

HTTP/1.1 200 OK
Date: Fri, 19 May 2017 23:49:34 GMT
Access-Control-Allow-Origin: *
Cache-Control: no-cache
Content-Type: application/json;charset=UTF-8
Connection: close
Server: Jetty(8.1.8.v20121106)

{"getWidevineLicenseResponse":{"license":"CAISoQMKKgoQQMAQpfHqiXs8Bs3VHzBM6RIQQMAQpfHqiXs8Bs3VHzBM6RoAIAEoABINCAEQARgBKAAw/5meARpmEhAuehL2qhKnTexb7QZUA+EgGlCeebVU0eFIAhopKWG+5zRiEsQdIiAvjpmcKghBi0XChkUT2+MIr6o2iZ0d2JxaD8ZyTspj6hgHGnFzTUm9Hybn+rtSp5Mcrhy8dgdn2V7w9SABGkoKEB6IU5Rb5VKgiYlZf65crpcSEIJ42moA7HXGVV2jUq5LHFoaIKNzirECWGOuAtJu/8eYbNwcvYRFVmXKm+YwZH+uDr4HIAIoARpKChANGrWY+LtWQ5h4lAc6AZOXEhBy9fOpZ2WFy2id2R+yv/erGiCaTkwVpZJHLEBmCHnReKG5X/BJtGjM8HvPtFhg8yiwvSACKAEaSgoQUHgq0sMYVB+eP9vTyp6y5hIQCIpTLpY1lvR3t0KvQw4UlBogpnMrai7Nd+y+xDbOB+pwyguBpSKpGTn2RgHYDksSYGkgAigBII6J/sgFOOPclZsGQgxIRENQREFUQQAAAAMaIKlMr1Cezed1Fq/YP9NilAxbcuT5n+18KBjOmXOLzi4RIoACkFpdquMRnCVxSOEfdHUEbv54QdgI0WyrEV8GCp9CcVmv8TQCEkDIbCyw+3ogkfYrxTeciXAhnP2XRQLSpa2FrSr7LX6pv1YueyZ3387rNmrnmWdvYEr2cFU0ptFwuXfYQs9IySWQ14GjAjv17WWc+lfD/7ex1IwFUK3RQ02fI0PDURY0VfM38Z1aXco4R1yzBc7Q9qABsd85NB+DahfXCRtS/WZZW1bTao7/FWEnDSYY/5Qxmqq7iGnWk0gJDuywZ8wjFH/OKgB7EIgv91r11NikRV35rmJWcwYYHUGr3TvLDJUIDcSc//nP+hujEuwOicUHtoLyVGxYiTCe5rnIGg=="}}

My license key format: playitem.setProperty('inputstream.adaptive.license_key', stream['license_url'].replace('{widevineChallenge}', 'B{SSM}') + '|||' + 'JBlicense')

emilsvennesson commented 7 years ago

@peak3d Also, the new code has introduced the 'Unable to handle decryption. Unsupported!' bug on another MPD sample that works if I revert the last two commits.

Here's the MPD: https://pastebin.com/FjiMsJfc

peak3d commented 7 years ago

@emilsvennesson

print(stream['license_url'].replace('{widevineChallenge}', 'B{SSM}')) pls. I guess that you may have already separators in it, could it be?

I'll look for the other issue, thx. Edit: issue fixed.

emilsvennesson commented 7 years ago

@peak3d 6:50:37.216` T:139983909881600 DEBUG: [plugin.video.viaplay-1.0.8]: https://widevine.entitlement.theplatform.eu/wv/web/ModularDrm/getWidevineLicense?form=json&schema=1.0&httpError=false&_releasePid=0bivYUSLrSPC&token=qBzRHcRUcPsgE1n4VQpmsfBOsHA6APBC&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&_widevineChallenge=B{SSM}

Here's a more extensive log of the playback attempt: https://pastebin.com/6tSJxyvp

I can confirm that the other issue has been fixed. Thanks! :-)

peak3d commented 7 years ago

In .kodi/cdm/, do you have there 3 files with hex-filenames? If so, pls zip them and upload.

If not, we have to enable the _DEBUG symbol in CMakeLists.txt of libssd_wv.so

Edit: I've enabled email in my git account, you can send me the data via mail.

emilsvennesson commented 7 years ago

@peak3d Yes, I've emailed them to you because I'm unsure if they contain any sensible information.

peak3d commented 7 years ago

I'll check what happens, but in general it looks already good

Am 20.05.2017 um 19:56 schrieb emilsvennesson:

@peak3d https://github.com/peak3d Yes, I've emailed them to you because I'm unsure if they contain any sensible information.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/emilsvennesson/kodi-viaplay/issues/9#issuecomment-302888644, or mute the thread https://github.com/notifications/unsubscribe-auth/AVpzZ6c3DPZGrMsIETyVfJEKWJ4kuJuUks5r7ylEgaJpZM4M-t0-.

peak3d commented 7 years ago

liberty-developer has changed wvdecrypter in his repo. Can you pls. try again?

emilsvennesson commented 7 years ago

@peak3d It works! :-D Thanks a lot for all your work, it's much appreciated.

So TV shows and movies all play flawlessly, but there seems to be some problems with the sports content. I took a quick look at the manifests and they look a bit different to what the other content looked like. The audio plays fine (so I would guess that it's getting decrypted correctly) but I'm getting no picture.

MPD file: https://pastebin.com/fM7QRWQv kodi.log: https://pastebin.com/LXpbAdRz

peak3d commented 7 years ago

Yes, heared of this issue, same with DAZN addon, will look at it tonight

One flavour: can you pls. disable Component logging until we are investigating something where it is used? Its really hard to read. Thanx!

emilsvennesson commented 7 years ago

@peak3d Sorry about that! I didn't realize I had enabled component logging for curl... no wonder it was spitting out a lot of data. Here's a new log: https://pastebin.com/hyV0w8wU

I kept ffmpeg component logging enabled but maybe you'd prefer if I disabled that as well?

peak3d commented 7 years ago

Because inputstream.adaptive is not using ffmpeg at all (it uses bento4 as demuxer) the ffmpeg lines are not topic related (they are flooding the log when scraping your disk for thumbs / changes).

ffmpeg component logging is the one I have never used and will never use. video is sometimes important, libCURL as well, but we already jumped over these issues.

From my POV always make without component logging, and I'll ask you for components if necessary. For now I don't need a new log, the mpd you provided is enough for testing.

peak3d commented 7 years ago

This commit: https://github.com/peak3d/inputstream.adaptive/commit/2cdb0c0ab9f1afe367ef22bc3818f2f61d071348

should solve your live-stream issue

emilsvennesson commented 7 years ago

I thought I'd give an update on this:

With the latest inputstream.adaptive and kodi-agile, Viaplay (and C More https://github.com/emilsvennesson/kodi-cmore) is working flawlessly in Kodi again. However, as this now requires libwidevine I might have to remove it from the official repository in the future depending on what stance Kodi decides to take on DRM. You can read more about that here: https://forum.kodi.tv/showthread.php?tid=313075

I would recommend people to wait for Kodi 18 to try this out unless you're familiar with building Kodi from source. Right now, patches that haven't been merged into mainline is required which means that you can't use a nightly Kodi build. This will hopefully change in the near future. There's instructions available on the Netflix plugin GitHub page if you want to take on the challenge: https://github.com/asciidisco/plugin.video.netflix/issues/30#issuecomment-290922066

Huge thanks to @peak3d for making this happen. I am going to leave this issue open until it gets easier to actually use this.

rikardfries commented 7 years ago

It would be nice to try it but I do not know if it is possible to run on Kodi 17.3 in a windows 10 machine. Think I have DRM and libwidevine in place ( from the Previous Magine installation). I will give it a try. As soon as I get the time. If it is ok with you ?

rikardfries commented 7 years ago

It seems to work fine. The thing that does not work is the texting on the CMORE film channels...

emilsvennesson commented 7 years ago

Closing as everything is fully working with Kodi 17.4. Here's some quick instructions:

Download kodi-viaplay from git and install. Follow the instructions below to install the required Widevine library:

Linux x86/Raspberry Pi

curl -Ls http://nmacleod.com/public/libreelec/getwidevine.sh | bash

Windows

Install a 32-bit web browser such as Google Chrome, search your system for widevinecdm.dll and copy the file to %APPDATA%\Kodi\cdm.

Android

Should work out-of-the-box!

mhemstrom commented 7 years ago

Hi,

I installed Libreelec 8.1.0 (Kernel: Linux 4.9.41) on a RPi3 with kodi version 17.4-RC1 Git:3aa19b0 I installed the Viaplay addon yet get the following error still: No valid stream URL was found.

After reading this thread i looks like Viaplay has changed the streaming to MPEG-DASH instead, but that kodi version 17.4 should of resolved this?

I also run this after install curl -Ls http://nmacleod.com/public/libreelec/getwidevine.sh | bash

Any thoughts on what could be the issue?

See log below.

Kodi log:

11:32:29.788 T:1945587712 DEBUG: ParentPath = [plugin://plugin.video.viaplay/?action=list_products&url=https%3a%2f%2fcontent.viaplay.se%2fpc-se%2fserier%2fcriminal-minds%3fseasonNumber%3d1%26partial%3d1%26blockId%3d9a795f6a-f8ed-4b95-b139-43cbb016df6c] 11:32:29.791 T:1945587712 DEBUG: Loading items: 22, directory: plugin://plugin.video.viaplay/?action=list_products&url=https%3a%2f%2fcontent.viaplay.se%2fpc-se%2fserier%2fcriminal-minds%3fseasonNumber%3d1%26partial%3d1%26blockId%3d9a795f6a-f8ed-4b95-b139-43cbb016df6c sort method: 0, ascending: false 11:32:29.819 T:1753215904 DEBUG: CAddonDatabase::SetLastUsed[plugin.video.viaplay] took 31 ms 11:32:29.828 T:1761604512 DEBUG: Thread BackgroundLoader start, auto delete: false 11:32:29.845 T:1753215904 INFO: easy_aquire - Created session to https://i-viaplay-com.akamaized.net 11:32:29.852 T:1606955936 DEBUG: COMXCoreComponent::Initialize OMX.broadcom.image_decode input port 320 output port 321 m_handle 0x7171f3e0 11:32:29.852 T:1606955936 DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.image_decode) - port(320), nBufferCountMin(2), nBufferCountActual(2), nBufferSize(154336), nBufferAlignmen(16) 11:32:29.855 T:1606955936 DEBUG: COMXCoreComponent::Initialize OMX.broadcom.egl_render input port 220 output port 221 m_handle 0x71720d00 11:32:29.856 T:1606955936 DEBUG: COMXCoreComponent::UseEGLImage component(OMX.broadcom.egl_render) - port(221), nBufferCountMin(1), nBufferCountActual(1), nBufferSize(15360) nBufferAlignmen(16) 11:32:29.862 T:1761604512 DEBUG: Thread BackgroundLoader 1761604512 terminating 11:32:29.880 T:1606955936 DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.image_decode handle 0x7171f3e0 11:32:29.881 T:1606955936 DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.egl_render handle 0x71720d00 11:32:29.882 T:1606955936 DEBUG: DecodeJpegToTexture: decoded special://masterprofile/Thumbnails/8/8fe39343.jpg 1280x720 11:32:30.022 T:1753215904 DEBUG: CurlFile::Open(0x60668560) https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg 11:32:30.424 T:1753215904 ERROR: COMXImageFile::ReadFile https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg m_image_size zero 11:32:30.462 T:1753215904 DEBUG: CCurlFile::GetMimeType - https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg -> image/jpeg 11:32:30.463 T:1753215904 DEBUG: CurlFile::Open(0x6252ee30) https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg 11:32:30.669 T:1753215904 ERROR: COMXImageFile::ReadFile https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg m_image_size zero 11:32:30.676 T:1753215904 NOTICE: LoadJpeg: unable to load https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg 11:32:30.676 T:1753215904 DEBUG: CurlFile::Open(0x60668560) https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg 11:32:31.073 T:1945587712 DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x0000, modifier: 0x0 11:32:31.233 T:1945587712 DEBUG: OnKey: return (0xf00d) pressed, action is Select 11:32:31.248 T:1945587712 DEBUG: OnPlayMedia plugin://plugin.video.viaplay/?action=play_video&content=episode&streamtype=guid&playid=S86274 11:32:31.264 T:1945587712 DEBUG: StartScript - calling plugin Viaplay('plugin://plugin.video.viaplay/','14','?action=play_video&content=episode&streamtype=guid&playid=S86274') 11:32:31.265 T:1535112096 DEBUG: Thread LanguageInvoker start, auto delete: false 11:32:31.265 T:1535112096 INFO: initializing python engine. 11:32:31.265 T:1535112096 DEBUG: CPythonInvoker(15, /storage/.kodi/addons/plugin.video.viaplay/default.py): start processing 11:32:31.275 T:1945584544 DEBUG: CAnnouncementManager - Announcement: OnAdd from xbmc 11:32:31.275 T:1945584544 DEBUG: GOT ANNOUNCEMENT, type: 2, from xbmc, message OnAdd 11:32:31.286 T:1761604512 DEBUG: Thread scriptobs start, auto delete: false 11:32:31.332 T:1535112096 DEBUG: -->Python Interpreter Initialized<-- 11:32:31.333 T:1535112096 DEBUG: CPythonInvoker(15, /storage/.kodi/addons/plugin.video.viaplay/default.py): the source file to load is "/storage/.kodi/addons/plugin.video.viaplay/default.py" 11:32:31.333 T:1535112096 DEBUG: CPythonInvoker(15, /storage/.kodi/addons/plugin.video.viaplay/default.py): setting the Python path to /storage/.kodi/addons/plugin.video.viaplay:/storage/.kodi/addons/script.module.iso8601/lib:/storage/.kodi/addons/script.module.requests/lib:/usr/lib/python27.zip:/usr/lib/python2.7:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages/gtk-2.0 11:32:31.334 T:1535112096 DEBUG: CPythonInvoker(15, /storage/.kodi/addons/plugin.video.viaplay/default.py): entering source directory /storage/.kodi/addons/plugin.video.viaplay 11:32:31.334 T:1535112096 DEBUG: CPythonInvoker(15, /storage/.kodi/addons/plugin.video.viaplay/default.py): instantiating addon using automatically obtained id of "plugin.video.viaplay" dependent on version 2.25.0 of the xbmc.python api 11:32:31.486 T:1945587712 DEBUG: ------ Window Init (DialogBusy.xml) ------ 11:32:31.602 T:1753215904 DEBUG: Caching image 'https://i-viaplay-com.akamaized.net/scandi/Viaplay_Prod_-_Scandi/475/972/1466518001-9ae40244a5b01a315f53d869eb4b8695654d4b93.jpg' to '0/09411430.jpg': 11:32:31.883 T:1535112096 DEBUG: [vialib]: URL: https://play.viaplay.se/api/stream/byguid 11:32:32.036 T:1535112096 ERROR: /storage/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/connectionpool.py:843: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning) 11:32:32.217 T:1753215904 DEBUG: cached image 'special://masterprofile/Thumbnails/0/09411430.jpg' size 1280x720 11:32:32.218 T:1753215904 DEBUG: COMXCoreComponent::Initialize OMX.broadcom.image_encode input port 340 output port 341 m_handle 0x5bbe42e0 11:32:32.219 T:1753215904 DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.image_encode) - port(340), nBufferCountMin(1), nBufferCountActual(1), nBufferSize(3686400), nBufferAlignmen(16) 11:32:32.219 T:1753215904 DEBUG: COMXCoreComponent::AllocOutputBuffers component(OMX.broadcom.image_encode) - port(341), nBufferCountMin(1), nBufferCountActual(1), nBufferSize(921600) nBufferAlignmen(16) 11:32:32.247 T:1753215904 DEBUG: COMXImageEnc::CreateThumbnailFromSurface : special://masterprofile/Thumbnails/0/09411430.jpg width 1280 height 720 11:32:32.249 T:1753215904 DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.image_encode handle 0x5bbe42e0 11:32:32.564 T:1535112096 DEBUG: [vialib]: Response code: 200 11:32:32.565 T:1535112096 DEBUG: [vialib]: Response: {"serverTime":"2017-09-01T11:32:32.411Z","kId":"QlI5Rv5qIzOAlLDTOZf/QA==","checksum":"wQeBAtyuRmA=","productId":null,"product":{"content":{"parentalRating":"12","type":"vod"}},"duration":2527072,"isDvr":false,"socket":{"streamId":"S86274","userId":"621A3AB7C15BAFDE","mediaId":"1599045448"},"socket2":{"productGuid":"S86274","mediaId":"1599045448","runningUpdateIntervalSeconds":20},"conviva":{"assetName":"[S86274] Criminal Minds","cdnName":"LEVEL3","isLive":false,"viewerId":"mikael_hemstrom@hotmail.com","tags":{"ConsumerId":"621A3AB7C15BAFDE","Format":"HLS","HouseNumber":"S86274","CdnServer":"vod-hls-cdn2-vp.cdn.viaplay.tv","Territory":"se"}},"audioTracks":null,"_links":{"curies":[{"name":"viaplay","href":"http://docs.viaplay.tv/rel/{rel}","templated":true}],"viaplay:license":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:fairplayLicense":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:encryptedPlaylist":{"href":"https://vod-hls-cdn2-vp.cdn.viaplay.tv/56e58b3/S86274-1503399355772.ism/master.m3u8?start_index=2&filter=%28FourCC%3D%3D%22AVC1%22%26%26systemBitrate%3C10000000%26%26systemBitrate%3E400000%26%26framerate%3C60%29%7C%7C%28type%3D%3D%22audio%22%26%26%28FourCC%3D%3D%22EC-3%22%7C%7CFourCC%3D%3D%22ac-3%22%7C%7CFourCC%3D%3D%22AACL%22%29%29%7C%7C%28type%3D%3D%22textstream%22%29","embeddedSubtitles":true,"streamingFormat":"HLS"},"viaplay:sami":[{"languageCode":"da","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_da-1455805813582.sami"},{"languageCode":"fi","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_fi-1455805813582.sami"},{"languageCode":"sv","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_sv-1455805813582.sami","default":true},{"languageCode":"no","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_no-1455805813582.sami"}],"viaplay:certificate":{"href":"https://play.viaplay.se/certificates/fairplay","templated":false},"viaplay:nextentry":{"href":"https://play.viaplay.se/api/stream/byguid?deviceId=086cc8e3-974c-4de2-88e2-5d87b4363ef5&deviceName=web&deviceType=pc&userAgent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+WOW64%3B+rv%3A47.0%29+Gecko%2F20100101+Firefox%2F47.0&deviceKey=atv-se&returnurl&sectionPath&fetchNextEpisode=true&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117&guid=S86274"},"viaplay:nextentryProduct":{"href":"https://play.viaplay.se/api/nextentry/product{?deviceKey}&sectionPath=&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117"}},"chapters":[{"title":"endcredits","startTime":2491000}],"pushNextEpisode":{"startTime":2491000,"endTime":2506000,"startNextTime":2506000,"defaultValueUsed":false,"duration":15000},"reporting":{"correlationId":"b0f970a9-f618-4a72-b1d7-68b237b5c127","sessionGuid":"eJwlyVsKAjEMQNEVhbRJ8/BzxscGXMHYZqCgfkzF9Vvw58DlKuWFl9XOWdbldrni9vnCCEyutXownKxUKC0I3CfS3B6FlWMXvLuSFcQswY21Uq5owglJE5n/vyDN9l0Tjjh6DKhHf/X39oRpG1h+0SQjgA==","reportingUrl":"https://socket2.viaplay.se/eJwlyVsKAjEMQNEVhbRJ8_BzxscGXMHYZqCgfkzF9Vvw58DlKuWFl9XOWdbldrni9vnCCEyutXownKxUKC0I3CfS3B6FlWMXvLuSFcQswY21Uq5owglJE5n_vyDN9l0Tjjh6DKhHf_X39oRpG1h-0SQjgA~~$KSAsrCvcyQgG90O9H_QYZ49LXNMaOH9HFqPTF7kPKXk~/{actionType}/{sequenceNumber}/{deltaTime}/{duration}/{position}/{?bitrate,error,startupTime}","updateInterval":60000,"actionTypes":[{"key":"legacyPlay","value":0},{"key":"pause","value":1},{"key":"unload","value":2},{"key":"running","value":3},{"key":"startOver","value":4},{"key":"gotoLive","value":5},{"key":"scrub","value":6},{"key":"buffering","value":9},{"key":"videoStartFailure","value":10},{"key":"exitBeforeStart","value":11},{"key":"resume","value":12},{"key":"play","value":13}]}} 11:32:32.568 T:1535112096 DEBUG: [vialib]: URL: https://play.viaplay.se/api/stream/byguid 11:32:32.575 T:1535112096 ERROR: /storage/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/connectionpool.py:843: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning) 11:32:33.096 T:1535112096 DEBUG: [vialib]: Response code: 200 11:32:33.096 T:1535112096 DEBUG: [vialib]: Response: {"serverTime":"2017-09-01T11:32:32.937Z","kId":"QlI5Rv5qIzOAlLDTOZf/QA==","checksum":"wQeBAtyuRmA=","productId":null,"product":{"content":{"parentalRating":"12","type":"vod"}},"duration":2527072,"isDvr":false,"socket":{"streamId":"S86274","userId":"621A3AB7C15BAFDE","mediaId":"1599045448"},"socket2":{"productGuid":"S86274","mediaId":"1599045448","runningUpdateIntervalSeconds":20},"conviva":{"assetName":"[S86274] Criminal Minds","cdnName":"LEVEL3","isLive":false,"viewerId":"mikael_hemstrom@hotmail.com","tags":{"ConsumerId":"621A3AB7C15BAFDE","Format":"HLS","HouseNumber":"S86274","CdnServer":"vod-hls-cdn2-vp.cdn.viaplay.tv","Territory":"se"}},"audioTracks":null,"_links":{"curies":[{"name":"viaplay","href":"http://docs.viaplay.tv/rel/{rel}","templated":true}],"viaplay:license":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:fairplayLicense":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:encryptedPlaylist":{"href":"https://vod-hls-cdn2-vp.cdn.viaplay.tv/56e58b3/S86274-1503399355772.ism/master.m3u8?start_index=2&filter=%28FourCC%3D%3D%22AVC1%22%26%26systemBitrate%3C10000000%26%26systemBitrate%3E400000%26%26framerate%3C60%29%7C%7C%28type%3D%3D%22audio%22%26%26%28FourCC%3D%3D%22EC-3%22%7C%7CFourCC%3D%3D%22ac-3%22%7C%7CFourCC%3D%3D%22AACL%22%29%29%7C%7C%28type%3D%3D%22textstream%22%29","embeddedSubtitles":true,"streamingFormat":"HLS"},"viaplay:sami":[{"languageCode":"da","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_da-1455805813582.sami"},{"languageCode":"fi","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_fi-1455805813582.sami"},{"languageCode":"sv","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_sv-1455805813582.sami","default":true},{"languageCode":"no","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_no-1455805813582.sami"}],"viaplay:certificate":{"href":"https://play.viaplay.se/certificates/fairplay","templated":false},"viaplay:nextentry":{"href":"https://play.viaplay.se/api/stream/byguid?deviceId=086cc8e3-974c-4de2-88e2-5d87b4363ef5&deviceName=web&deviceType=pc&userAgent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+WOW64%3B+rv%3A47.0%29+Gecko%2F20100101+Firefox%2F47.0&deviceKey=atv-se&returnurl&sectionPath&fetchNextEpisode=true&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117&guid=S86274"},"viaplay:nextentryProduct":{"href":"https://play.viaplay.se/api/nextentry/product{?deviceKey}&sectionPath=&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117"}},"chapters":[{"title":"endcredits","startTime":2491000}],"pushNextEpisode":{"startTime":2491000,"endTime":2506000,"startNextTime":2506000,"defaultValueUsed":false,"duration":15000},"reporting":{"correlationId":"613e7572-416d-403f-8ecb-eec60964549c","sessionGuid":"eJwlyU0KAyEMQOEThWiiSbp0+nOBnsBqBoS2i7H0/BW6+eDxhGLhsuk55q3cLlesny9Mx2DSmjnDSVOD1J3AbJG76SOxsO8Z7yakCTFm587SElXUzAFJAqn9f0ZabbsEnH4Mn9CO8Rrv+oRln5h+0V4jgQ==","reportingUrl":"https://socket2.viaplay.se/eJwlyU0KAyEMQOEThWiiSbp0-nOBnsBqBoS2i7H0_BW6-eDxhGLhsuk55q3cLlesny9Mx2DSmjnDSVOD1J3AbJG76SOxsO8Z7yakCTFm587SElXUzAFJAqn9f0ZabbsEnH4Mn9CO8Rrv-oRln5h-0V4jgQ~~$ttqfPGTLcqq-XVEpWtajmy7hMC8DMV6WFBsjgKzOEh0~/{actionType}/{sequenceNumber}/{deltaTime}/{duration}/{position}/{?bitrate,error,startupTime}","updateInterval":60000,"actionTypes":[{"key":"legacyPlay","value":0},{"key":"pause","value":1},{"key":"unload","value":2},{"key":"running","value":3},{"key":"startOver","value":4},{"key":"gotoLive","value":5},{"key":"scrub","value":6},{"key":"buffering","value":9},{"key":"videoStartFailure","value":10},{"key":"exitBeforeStart","value":11},{"key":"resume","value":12},{"key":"play","value":13}]}} 11:32:33.102 T:1535112096 DEBUG: [vialib]: URL: https://play.viaplay.se/api/stream/byguid 11:32:33.116 T:1535112096 ERROR: /storage/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/connectionpool.py:843: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning) 11:32:33.542 T:1535112096 DEBUG: [vialib]: Response code: 200 11:32:33.543 T:1535112096 DEBUG: [vialib]: Response: {"serverTime":"2017-09-01T11:32:33.445Z","kId":"QlI5Rv5qIzOAlLDTOZf/QA==","checksum":"wQeBAtyuRmA=","productId":null,"product":{"content":{"parentalRating":"12","type":"vod"}},"duration":2527072,"isDvr":false,"socket":{"streamId":"S86274","userId":"621A3AB7C15BAFDE","mediaId":"1599045448"},"socket2":{"productGuid":"S86274","mediaId":"1599045448","runningUpdateIntervalSeconds":20},"conviva":{"assetName":"[S86274] Criminal Minds","cdnName":"LEVEL3","isLive":false,"viewerId":"mikael_hemstrom@hotmail.com","tags":{"ConsumerId":"621A3AB7C15BAFDE","Format":"HLS","HouseNumber":"S86274","CdnServer":"vod-hls-cdn2-vp.cdn.viaplay.tv","Territory":"se"}},"audioTracks":null,"_links":{"curies":[{"name":"viaplay","href":"http://docs.viaplay.tv/rel/{rel}","templated":true}],"viaplay:license":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:fairplayLicense":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:encryptedPlaylist":{"href":"https://vod-hls-cdn2-vp.cdn.viaplay.tv/56e58b3/S86274-1503399355772.ism/master.m3u8?start_index=2&filter=%28FourCC%3D%3D%22AVC1%22%26%26systemBitrate%3C10000000%26%26systemBitrate%3E400000%26%26framerate%3C60%29%7C%7C%28type%3D%3D%22audio%22%26%26%28FourCC%3D%3D%22EC-3%22%7C%7CFourCC%3D%3D%22ac-3%22%7C%7CFourCC%3D%3D%22AACL%22%29%29%7C%7C%28type%3D%3D%22textstream%22%29","embeddedSubtitles":true,"streamingFormat":"HLS"},"viaplay:sami":[{"languageCode":"da","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_da-1455805813582.sami"},{"languageCode":"fi","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_fi-1455805813582.sami"},{"languageCode":"sv","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_sv-1455805813582.sami","default":true},{"languageCode":"no","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_no-1455805813582.sami"}],"viaplay:certificate":{"href":"https://play.viaplay.se/certificates/fairplay","templated":false},"viaplay:nextentry":{"href":"https://play.viaplay.se/api/stream/byguid?deviceId=086cc8e3-974c-4de2-88e2-5d87b4363ef5&deviceName=web&deviceType=pc&userAgent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+WOW64%3B+rv%3A47.0%29+Gecko%2F20100101+Firefox%2F47.0&deviceKey=atv-se&returnurl&sectionPath&fetchNextEpisode=true&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117&guid=S86274"},"viaplay:nextentryProduct":{"href":"https://play.viaplay.se/api/nextentry/product{?deviceKey}&sectionPath=&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117"}},"chapters":[{"title":"endcredits","startTime":2491000}],"pushNextEpisode":{"startTime":2491000,"endTime":2506000,"startNextTime":2506000,"defaultValueUsed":false,"duration":15000},"reporting":{"correlationId":"ee966290-7b40-44ea-8404-8c927038f3c8","sessionGuid":"eJwlyVsKAjEMQNEVhXSS5uFnx8cGXMHYZqCgfkzF9Vvw58DlKi2Fy2rnRdZyu1xx+3xhBCbXWj0YTpYr5BYE7hNpbo/MyrEL3l3JMuIiwY21KimacELSROb/L0izfdeEI44eA+rRX/29PWHaBuYfyOUjWA==","reportingUrl":"https://socket2.viaplay.se/eJwlyVsKAjEMQNEVhXSS5uFnx8cGXMHYZqCgfkzF9Vvw58DlKi2Fy2rnRdZyu1xx-3xhBCbXWj0YTpYr5BYE7hNpbo_MyrEL3l3JMuIiwY21KimacELSROb_L0izfdeEI44eA-rRX_29PWHaBuYfyOUjWA~~$I0iBinpLuUStZgSgKkSBc0sLU5JeB1aPrVIJA7k1usg~/{actionType}/{sequenceNumber}/{deltaTime}/{duration}/{position}/{?bitrate,error,startupTime}","updateInterval":60000,"actionTypes":[{"key":"legacyPlay","value":0},{"key":"pause","value":1},{"key":"unload","value":2},{"key":"running","value":3},{"key":"startOver","value":4},{"key":"gotoLive","value":5},{"key":"scrub","value":6},{"key":"buffering","value":9},{"key":"videoStartFailure","value":10},{"key":"exitBeforeStart","value":11},{"key":"resume","value":12},{"key":"play","value":13}]}} 11:32:33.548 T:1535112096 DEBUG: [vialib]: URL: https://play.viaplay.se/api/stream/byguid 11:32:33.562 T:1535112096 ERROR: /storage/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/connectionpool.py:843: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning) 11:32:33.903 T:1535112096 DEBUG: [vialib]: Response code: 200 11:32:33.904 T:1535112096 DEBUG: [vialib]: Response: {"serverTime":"2017-09-01T11:32:33.800Z","kId":"QlI5Rv5qIzOAlLDTOZf/QA==","checksum":"wQeBAtyuRmA=","productId":null,"product":{"content":{"parentalRating":"12","type":"vod"}},"duration":2527072,"isDvr":false,"socket":{"streamId":"S86274","userId":"621A3AB7C15BAFDE","mediaId":"1599045448"},"socket2":{"productGuid":"S86274","mediaId":"1599045448","runningUpdateIntervalSeconds":20},"conviva":{"assetName":"[S86274] Criminal Minds","cdnName":"LEVEL3","isLive":false,"viewerId":"mikael_hemstrom@hotmail.com","tags":{"ConsumerId":"621A3AB7C15BAFDE","Format":"HLS","HouseNumber":"S86274","CdnServer":"vod-hls-cdn2-vp.cdn.viaplay.tv","Territory":"se"}},"audioTracks":null,"_links":{"curies":[{"name":"viaplay","href":"http://docs.viaplay.tv/rel/{rel}","templated":true}],"viaplay:license":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:fairplayLicense":{"href":"https://fairplay.entitlement.theplatform.eu/fpls/web/FairPlay?form=json&schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2361940180&token=e5np-9KShjEgigpqd0rMwfCQcODMMODe&_releasePid=MZFL7y_TFMAL","templated":false,"releasePid":"MZFL7y_TFMAL"},"viaplay:encryptedPlaylist":{"href":"https://vod-hls-cdn2-vp.cdn.viaplay.tv/56e58b3/S86274-1503399355772.ism/master.m3u8?start_index=2&filter=%28FourCC%3D%3D%22AVC1%22%26%26systemBitrate%3C10000000%26%26systemBitrate%3E400000%26%26framerate%3C60%29%7C%7C%28type%3D%3D%22audio%22%26%26%28FourCC%3D%3D%22EC-3%22%7C%7CFourCC%3D%3D%22ac-3%22%7C%7CFourCC%3D%3D%22AACL%22%29%29%7C%7C%28type%3D%3D%22textstream%22%29","embeddedSubtitles":true,"streamingFormat":"HLS"},"viaplay:sami":[{"languageCode":"da","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_da-1455805813582.sami"},{"languageCode":"fi","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_fi-1455805813582.sami"},{"languageCode":"sv","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_sv-1455805813582.sami","default":true},{"languageCode":"no","href":"https://subs-scandi.secure.footprint.net/Viaplay_Prod_-_Scandi/501/992/S86274_no-1455805813582.sami"}],"viaplay:certificate":{"href":"https://play.viaplay.se/certificates/fairplay","templated":false},"viaplay:nextentry":{"href":"https://play.viaplay.se/api/stream/byguid?deviceId=086cc8e3-974c-4de2-88e2-5d87b4363ef5&deviceName=web&deviceType=pc&userAgent=Mozilla%2F5.0+%28Windows+NT+10.0%3B+WOW64%3B+rv%3A47.0%29+Gecko%2F20100101+Firefox%2F47.0&deviceKey=atv-se&returnurl&sectionPath&fetchNextEpisode=true&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117&guid=S86274"},"viaplay:nextentryProduct":{"href":"https://play.viaplay.se/api/nextentry/product{?deviceKey}&sectionPath=&formatId=http%3A%2F%2Fdata.entertainment.tv.theplatform.eu%2Fentertainment%2Fdata%2FProgram%2Fguid%2F2361940180%2Fseries-criminal-minds&seriesEpisodeNumber=117"}},"chapters":[{"title":"endcredits","startTime":2491000}],"pushNextEpisode":{"startTime":2491000,"endTime":2506000,"startNextTime":2506000,"defaultValueUsed":false,"duration":15000},"reporting":{"correlationId":"6476aac2-4e1a-4c8d-9f9d-d8603debf5ad","sessionGuid":"eJwlyUkKwzAMQNETGdmSNWTpdLhAT5DaChjaLuLQ89fQzYPPF0yFyqqXxGu5X2+wnd8wHKJJreYUFs015OYYzCbcTJ+ZhHxneJigZoDETo2kqi2gTBFQIqr9PwPOtl0iDD+6j1CP/u6f7RWmbUD+Acr/I2I=","reportingUrl":"https://socket2.viaplay.se/eJwlyUkKwzAMQNETGdmSNWTpdLhAT5DaChjaLuLQ89fQzYPPF0yFyqqXxGu5X2-wnd8wHKJJreYUFs015OYYzCbcTJ-ZhHxneJigZoDETo2kqi2gTBFQIqr9PwPOtl0iDD-6j1CP_u6f7RWmbUD-Acr_I2I~$y69dGWqQu096UOVqm2aTcEXgkE4X_wkKSb_ZNDi7270~/{actionType}/{sequenceNumber}/{deltaTime}/{duration}/{position}/{?bitrate,error,startupTime}","updateInterval":60000,"actionTypes":[{"key":"legacyPlay","value":0},{"key":"pause","value":1},{"key":"unload","value":2},{"key":"running","value":3},{"key":"startOver","value":4},{"key":"gotoLive","value":5},{"key":"scrub","value":6},{"key":"buffering","value":9},{"key":"videoStartFailure","value":10},{"key":"exitBeforeStart","value":11},{"key":"resume","value":12},{"key":"play","value":13}]}} 11:32:33.911 T:1535112096 DEBUG: [vialib]: Unable to retrieve stream URL. 11:32:33.969 T:1945587712 DEBUG: ------ Window Init (DialogConfirm.xml) ------ 11:32:59.845 T:1858073504 DEBUG: Thread JobWorker 1858073504 terminating (autodelete) 11:32:59.882 T:1606955936 DEBUG: Thread JobWorker 1606955936 terminating (autodelete)

Regards, Markus

Rune-C commented 6 years ago

image

iam really new at this. But i get this fault when use your code . what am i doing wrong thx for the good work

sopparus commented 6 years ago

@Rune-C there are no 64 bit widewine files for arch, I guess you are using odroid c2? In that case you need to find 32 bit builds of osmc.

I know that 32bit libreelec exist for odroid c2

techbliss commented 6 years ago

Hello @emilsvennesson
i am trying myself to fiddle with the widevine server respons. how do i know what part of the licence reponse is the actual key, since i wanna decrypt the stream offline.

deleder commented 6 years ago

This is somewhat off-topic, but would anyone know if the same method could be applied to TV2 Sumo? www.tv2sumo.no

They use DASH, and I think widevine. Would it be technically possible? If someone wants to have a look please speak out.

peak3d commented 6 years ago

@deleder If it works in browser, it will work with kodi, too.

GianniDPC commented 5 years ago

@emilsvennesson Hi I'm trying to create a Kodi Addon for the Belgian Yelo Play streaming application.

My POST request seems a bit different as it is base64 encoded, I decoded it and it seems to have a little more information being send than the payload only, I can see that the included payload however looks very close to your wv_challenge, so base64 encoded. What I don't understand is how is this generated? I read you said it was generated by the widevine binary but how can I access that within my application?

If I decode this wv_challenge I get something almost completely unreadable except the string "license.widevine.com."

Decoded it looks something like this (I removed some information but you get the idea): { "LatensRegistration": { "CustomerName": "", "AccountName": "", "PortalId": "", "FriendlyName": "", "DeviceInfo": { "FormatVersion": "1", "DeviceType": "", "OSType": "", "OSVersion": "", "DRMProvider": "", "DRMVersion": "", "DRMType": "", "DeviceVendor": "", "DeviceModel": "" } }, "Payload": "CAES2isSWwpZC... // still encoded