asciidisco / plugin.video.netflix

Inputstream based Netflix plugin for Kodi
MIT License
1.24k stars 225 forks source link

[MSL] Error parsing chunked response, video does not play #197

Closed alfablac closed 6 years ago

alfablac commented 6 years ago

I'm submitting a ...

Prerequisites

Installation

Operating System

Not sure if this is on my end, since it seems the system refuse to resolve msftncsi.com Disabled my firewall, tested with a "working" VPN. Same error. Netflix works on Chrome though.

11:03:08.258 T:18244  NOTICE: Running the application...
11:03:08.259 T:17792  NOTICE: ES: Starting UDP Event server on port 9777
11:03:08.259 T:17792  NOTICE: UDP: Listening on port 9777 (ipv6 : false)
11:03:09.052 T:1824   ERROR: CCurlFile::Exists - Failed: Couldn't resolve host name(6) for http://www.msftncsi.com/ncsi.txt
11:03:11.436 T:10396   ERROR: XFILE::CDirectory::GetDirectory - Error getting
11:03:25.183 T:19640   ERROR: Previous line repeats 6 times.
11:03:25.183 T:19640 WARNING: Invalid media type ""
11:03:26.904 T:15532 WARNING: Previous line repeats 5 times.
11:03:26.904 T:15532   ERROR: CCurlFile::Exists - Failed: Couldn't resolve host name(6) for http://www.msftncsi.com/ncsi.txt
11:03:30.266 T:16092 WARNING: Invalid media type ""
11:03:38.978 T:18244  NOTICE: VideoPlayer::OpenFile: http://localhost:16919/manifest?id=70221567
11:03:38.978 T:14772  NOTICE: Creating InputStream
11:03:41.430 T:3880   ERROR: Traceback (most recent call last):
11:03:41.430 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\SocketServer.py", line 290, in _handle_request_noblock
11:03:41.430 T:3880   ERROR:     self.process_request(request, client_address)
11:03:41.430 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\SocketServer.py", line 318, in process_request
11:03:41.430 T:3880   ERROR:     self.finish_request(request, client_address)
11:03:41.430 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\SocketServer.py", line 331, in finish_request
11:03:41.431 T:3880   ERROR:     self.RequestHandlerClass(request, client_address, self)
11:03:41.431 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\SocketServer.py", line 652, in __init__
11:03:41.431 T:3880   ERROR:     self.handle()
11:03:41.431 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\BaseHTTPServer.py", line 340, in handle
11:03:41.431 T:3880   ERROR:     self.handle_one_request()
11:03:41.431 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\BaseHTTPServer.py", line 328, in handle_one_request
11:03:41.431 T:3880   ERROR:     method()
11:03:41.431 T:3880   ERROR:   File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.netflix\resources\lib\MSLHttpRequestHandler.py", line 59, in do_GET
11:03:41.431 T:3880   ERROR:     data = MSL.load_manifest(int(params['id'][0]))
11:03:41.431 T:3880   ERROR:   File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.netflix\resources\lib\MSL.py", line 234, in load_manifest
11:03:41.431 T:3880   ERROR:     data = self.__decrypt_payload_chunk(resp['payloads'][0])
11:03:41.431 T:3880   ERROR:   File "C:\Users\XXXXXX\AppData\Roaming\Kodi\addons\plugin.video.netflix\resources\lib\MSL.py", line 312, in __decrypt_payload_chunk
11:03:41.431 T:3880   ERROR:     data = json.JSONDecoder().decode(data)[1]['payload']['data']
11:03:41.431 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\json\decoder.py", line 364, in decode
11:03:41.431 T:3880   ERROR:     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
11:03:41.431 T:3880   ERROR:   File "C:\Program Files (x86)\Kodi\system\python\Lib\json\decoder.py", line 380, in raw_decode
11:03:41.431 T:3880   ERROR:     obj, end = self.scan_once(s, idx)
11:03:41.431 T:3880   ERROR: ValueError: Unterminated string starting at: line 1 column 78 (char 77)
11:03:41.432 T:14772   ERROR: CCurlFile::FillBuffer - Failed: Server returned nothing (no headers, no data)(52)
11:03:41.432 T:14772   ERROR: CCurlFile::Open failed with code 0 for http://localhost:16919/manifest?id=70221567|acceptencoding=gzip&seekable=0&user-agent=Mozilla%2f5.0%20(Windows%20NT%206.1%3b%20WOW64)%20AppleWebKit%2f537.36%20(KHTML%2c%20like%20Gecko)%20Chrome%2f59.0.3071.115%20Safari%2f537.36
11:03:41.432 T:14772   ERROR: AddOnLog: InputStream Adaptive: Could not open / parse mpdURL (http://localhost:16919/manifest?id=70221567)
11:03:41.432 T:14772   ERROR: CVideoPlayer::OpenInputStream - error opening [http://localhost:16919/manifest?id=70221567]
11:03:41.432 T:14772  NOTICE: CVideoPlayer::OnExit()
11:03:44.987 T:18244 WARNING: CGUIWindowManager - CGUIWindowManager::HandleAction - ignoring action 107, because topmost modal dialog closing animation is running
asciidisco commented 6 years ago

I rephrased the title, as this is not the real problem. The real problem ist, that Netflix seems to have changed something in the way they deliver the chunked responses for the manifest (for some titles), in a way that the plugin is not able to cope with it.

I hope that this might be an temporary issue, but if not, I would definitely hope that @trummerjo can take a look, as he´s the one who originally wrote the service...

fkpp commented 6 years ago

Similar issue happening to me. Was working the days before.

raspberry pi 3: LibreELEC (Milhouse): devel-20171010210712-#1010-g87d8234 [Build #1010] 9.0, kernel: Linux ARM 32-bit version 4.13.5

19:51:42.943 T:1942861808  NOTICE: m_playbackStarting
19:51:42.943 T:1942861808  NOTICE: StereoscopicsManager::IsPlaying
19:51:43.170 T:1672242064   ERROR: Traceback (most recent call last):
19:51:43.170 T:1672242064   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
19:51:43.170 T:1672242064   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
19:51:43.170 T:1672242064   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
19:51:43.170 T:1672242064   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
19:51:43.170 T:1672242064   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
19:51:43.170 T:1672242064   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
19:51:43.171 T:1672242064   ERROR:   File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/MSLHttpRequestHandler.py", line 49, in do_GET
19:51:43.173 T:1672242064   ERROR:     data = msl.load_manifest(int(params['id'][0]))
19:51:43.173 T:1672242064   ERROR:   File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/MSL.py", line 226, in load_manifest
19:51:43.178 T:1672242064   ERROR:     data = self.__decrypt_payload_chunk(resp['payloads'][0])
19:51:43.178 T:1672242064   ERROR:   File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/MSL.py", line 297, in __decrypt_payload_chunk
19:51:43.178 T:1672242064   ERROR:     data = json.JSONDecoder().decode(data)[1]['payload']['data']
19:51:43.178 T:1672242064   ERROR:   File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
19:51:43.178 T:1672242064   ERROR:   File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
19:51:43.179 T:1672242064   ERROR: ValueError: Unterminated string starting at: line 1 column 78 (char 77)
19:51:43.179 T:1125880720   ERROR: CCurlFile::FillBuffer - Failed: Server returned nothing (no headers, no data)(52)
19:51:43.179 T:1125880720   ERROR: CCurlFile::Open failed with code 0 for http://localhost:39047/manifest?id=80025322|acceptencoding=gzip&seekable=0&user-agent=Mozilla%2f5.0%20(X11%3b%20CrOS%20armv7l%207647.78.0)%20AppleWebKit%2f537.36%20(KHTML%2c%20like%20Gecko)%20Chrome%2f59.0.3071.115%20Safari%2f537.36
19:51:43.180 T:1125880720   ERROR: AddOnLog: InputStream Adaptive: Could not open / parse mpdURL (http://localhost:39047/manifest?id=80025322)
19:51:43.182 T:1125880720   ERROR: CVideoPlayer::OpenInputStream - error opening [http://localhost:39047/manifest?id=80025322]
19:51:43.182 T:1125880720  NOTICE: CVideoPlayer::OnExit()
fabrebatalla18 commented 6 years ago

I have the same problem, i think is because manifest is overdrived.

strzmiele commented 6 years ago

I can report exactly same erross like @fkpp Raspberry Pi 2: LibreELEC-RPi2.arm-9.0-Milhouse-20171017210247-#1017-gdc954af

DavideFioravanti commented 6 years ago

Same problem here: LibreELEC (community): Leia-testing-Gendo-01-10-2017 (S905.arm)

23:01:07.552 T:3596088208   ERROR: Traceback (most recent call last):
23:01:07.553 T:3596088208   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
23:01:07.553 T:3596088208   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
23:01:07.553 T:3596088208   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
23:01:07.554 T:3596088208   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
23:01:07.554 T:3596088208   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
23:01:07.555 T:3596088208   ERROR:   File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
23:01:07.555 T:3596088208   ERROR:   File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/MSLHttpRequestHandler.py", line 49, in do_GET
23:01:07.555 T:3596088208   ERROR:     data = msl.load_manifest(int(params['id'][0]))
23:01:07.555 T:3596088208   ERROR:   File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/MSL.py", line 226, in load_manifest
23:01:07.556 T:3596088208   ERROR:     data = self.__decrypt_payload_chunk(resp['payloads'][0])
23:01:07.556 T:3596088208   ERROR:   File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/MSL.py", line 297, in __decrypt_payload_chunk
23:01:07.556 T:3596088208   ERROR:     data = json.JSONDecoder().decode(data)[1]['payload']['data']
23:01:07.556 T:3596088208   ERROR:   File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
23:01:07.557 T:3596088208   ERROR:   File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
23:01:07.557 T:3596088208   ERROR:   File "/usr/lib/python2.7/json/decoder.py", line 36, in errmsg
23:01:07.557 T:3596088208   ERROR: TypeError: 'NoneType' object is not callable
23:01:07.557 T:3410514832   ERROR: CCurlFile::FillBuffer - Failed: Server returned nothing (no headers, no data)(52)
23:01:07.557 T:3410514832   ERROR: CCurlFile::Open failed with code 0 for http://localhost:33223/manifest?id=80098734|acceptencoding=gzip&seekable=0&user-agent=Mozilla%2f5.0%20(X11%3b%20CrOS%20armv7l%207647.78.0)%20AppleWebKit%2f537.36%20(KHTML%2c%20like%20Gecko)%20Chrome%2f59.0.3071.115%20Safari%2f537.36
23:01:07.558 T:3410514832   ERROR: AddOnLog: InputStream Adaptive: Could not open / parse mpdURL (http://localhost:33223/manifest?id=80098734)
23:01:07.560 T:3410514832   ERROR: CVideoPlayer::OpenInputStream - error opening [http://localhost:33223/manifest?id=80098734]
23:01:07.560 T:3410514832  NOTICE: CVideoPlayer::OnExit()
dreamhd2015 commented 6 years ago

Netflix has changed something in the request system. Can you fix it?

asciidisco commented 6 years ago

@dreamhd2015 You´ve seen what I´ve written in this exact issue 18 hours ago? https://github.com/asciidisco/plugin.video.netflix/issues/197#issuecomment-337631939

dreamhd2015 commented 6 years ago

@asciidisco If so, ask if it is believed that it could be repaired Thanks for answering

truedread commented 6 years ago

I think have fixed this issue in my fork: https://github.com/truedread/plugin.video.netflix specifically this commit: https://github.com/truedread/plugin.video.netflix/commit/84dce43ba513feb24ff501640c6886875f3c594c

Please let me know if it is OK to make a pull request @asciidisco

@trummerjo's code was specifically made for parsing payload chunks of length 1. Netflix is now delivering properly chunked payloads, and I fixed a bit of the code needed to properly parse and decrypt the chunks.

fabrebatalla18 commented 6 years ago

@truedread your fix your for me, thanks!

asciidisco commented 6 years ago

@truedread That was my thought as well, but haven’t had the time to dig in further. Please PR it. Thank you very much :)

ate commented 6 years ago

@truedread Confirmed your fix works for me. Thanks a lot!

asciidisco commented 6 years ago

Released as 0.12.2. Thank you again for delivering this fix 👍