andrewleech / plugin.video.netflixbmc

NetfliXBMC - Unofficial Netflix Add-on (Win/OSX/Linux)
http://forum.kodi.tv/showthread.php?tid=211574
GNU General Public License v2.0
56 stars 29 forks source link

Error while fetching data (PythonToCppException) #66

Closed pimjansen closed 3 years ago

pimjansen commented 8 years ago

Hi all,

I receive an error while fetching the latest movies from Netflix. Below is the log. As you can see there is a python exception. All other steps before went well like profile selection etc.

Specs: Plugin: 1.3.23 (latest git master) Ubuntu 15.10 Kodi 15.2 - Git: 02e7013 (Nov 1 2015)

23:58:30 T:140568402946112   DEBUG: Previous line repeats 15 times.
23:58:30 T:140568402946112   DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.netflixbmc/?mode=listVideos&thumb&type=movie&url=https%3a%2f%2fwww.netflix.com%2fWiRecentAdditionsGallery%3fnRR%3dreleaseDate%26nRT%3dall%26pn%3d1%26np%3d1%26actionMethod%3djson)
23:58:30 T:140568402946112   DEBUG:   ParentPath = [plugin://plugin.video.netflixbmc/?mode=main&thumb&type=movie&url]
23:58:30 T:140567275095808  NOTICE: Thread JobWorker start, auto delete: true
23:58:30 T:140567275095808   DEBUG: StartScript - calling plugin NetfliXBMC('plugin://plugin.video.netflixbmc/','12','?mode=listVideos&thumb&type=movie&url=https%3a%2f%2fwww.netflix.com%2fWiRecentAdditionsGallery%3fnRR%3dreleaseDate%26nRT%3dall%26pn%3d1%26np%3d1%26actionMethod%3djson')
23:58:30 T:140567275095808   DEBUG: WaitOnScriptResult - waiting on the NetfliXBMC (id=17) plugin...
23:58:30 T:140567946610432  NOTICE: Thread LanguageInvoker start, auto delete: false
23:58:30 T:140567946610432    INFO: initializing python engine.
23:58:30 T:140567946610432   DEBUG: CPythonInvoker(17, /home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py): start processing
23:58:30 T:140567946610432  NOTICE: -->Python Interpreter Initialized<--
23:58:30 T:140567946610432   DEBUG: CPythonInvoker(17, /home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py): the source file to load is "/home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py"
23:58:30 T:140567946610432   DEBUG: CPythonInvoker(17, /home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py): setting the Python path to /home/kodi/.kodi/addons/plugin.video.netflixbmc:/home/kodi/.kodi/addons/script.module.requests/lib:/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0:/usr/lib/python2.7/dist-packages/ubuntu-sso-client
23:58:30 T:140567946610432   DEBUG: CPythonInvoker(17, /home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py): entering source directory /home/kodi/.kodi/addons/plugin.video.netflixbmc
23:58:30 T:140567946610432   DEBUG: CPythonInvoker(17, /home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py): instantiating addon using automatically obtained id of "plugin.video.netflixbmc" dependent on version 2.1.0 of the xbmc.python api
23:58:30 T:140568402946112   DEBUG: ------ Window Init (DialogBusy.xml) ------
23:58:30 T:140567946610432  NOTICE: Traceback (most recent call last):
                                              File "/home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py", line 27, in <module>
                                                import resources.lib.pyOpenSSL
                                              File "/home/kodi/.kodi/addons/plugin.video.netflixbmc/resources/lib/pyOpenSSL/__init__.py", line 66, in <module>
                                                import OpenSSL
                                              File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
                                                from OpenSSL import rand, crypto, SSL
                                              File "/usr/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
                                                from OpenSSL._util import (
                                              File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 7, in <module>
                                                binding = Binding()
                                              File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 63, in __init__
                                                self._ensure_ffi_initialized()
                                              File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 95, in _ensure_ffi_initialized
                                                cls._register_osrandom_engine()
                                              File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 70, in _register_osrandom_engine
                                                raise RuntimeError("osrandom engine already registered")
                                            RuntimeError: osrandom engine already registered
23:58:30 T:140567946610432  NOTICE: ERROR importing OpenSSL handler
23:58:31 T:140566406240000   DEBUG: webserver: request received for /jsonrpc
23:58:31 T:140567946610432   DEBUG: LocalizeStrings: no strings.po file exist at /home/kodi/.kodi/addons/plugin.video.netflixbmc/resources/language/English, fallback to strings.xml
23:58:31 T:140567946610432   DEBUG: DialogProgress::StartModal called
23:58:31 T:140567946610432   DEBUG: ------ Window Init (DialogProgress.xml) ------
23:58:31 T:140567946610432  NOTICE: URL: https://www.netflix.com/WiRecentAdditionsGallery?nRR=releaseDate&nRT=all&pn=1&np=1&actionMethod=json
23:58:31 T:140567946610432   ERROR: /home/kodi/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/connectionpool.py:789: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
                                              InsecureRequestWarning)
23:58:33 T:140566406240000   DEBUG: webserver: request received for /jsonrpc
23:58:33 T:140567946610432  NOTICE: URL: https://www.netflix.com/WiRecentAdditionsGallery?nRR=releaseDate&nRT=all&pn=1&np=1&actionMethod=json
23:58:33 T:140567946610432   ERROR: /home/kodi/.kodi/addons/script.module.requests/lib/requests/packages/urllib3/connectionpool.py:789: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
                                              InsecureRequestWarning)
23:58:34 T:140567946610432   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IndexError'>
                                            Error Contents: list index out of range
                                            Traceback (most recent call last):
                                              File "/home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py", line 1313, in <module>
                                                listVideos(url, type, runAsWidget)
                                              File "/home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py", line 277, in listVideos
                                                listVideo(videoID, "", "", False, False, type)
                                              File "/home/kodi/.kodi/addons/plugin.video.netflixbmc/default.py", line 376, in listVideo
                                                title = match[0].strip()
                                            IndexError: list index out of range
                                            -->End of Python script error report<--
23:58:34 T:140568402946112   DEBUG: ------ Window Init (DialogKaiToast.xml) ------
23:58:34 T:140567946610432    INFO: Python script stopped
23:58:34 T:140567946610432   DEBUG: Thread LanguageInvoker 140567946610432 terminating
23:58:34 T:140567275095808   DEBUG:  WaitOnScriptResult - plugin exited prematurely - terminating
23:58:34 T:140568402946112   ERROR: GetDirectory - Error getting plugin://plugin.video.netflixbmc/?mode=listVideos&thumb&type=movie&url=https%3a%2f%2fwww.netflix.com%2fWiRecentAdditionsGallery%3fnRR%3dreleaseDate%26nRT%3dall%26pn%3d1%26np%3d1%26actionMethod%3djson
23:58:34 T:140568402946112   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.netflixbmc/?mode=listVideos&thumb&type=movie&url=https%3a%2f%2fwww.netflix.com%2fWiRecentAdditionsGallery%3fnRR%3dreleaseDate%26nRT%3dall%26pn%3d1%26np%3d1%26actionMethod%3djson) failed
23:58:34 T:140568402946112   DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.netflixbmc/?mode=main&thumb&type=movie&url)
23:58:34 T:140568402946112   DEBUG:   ParentPath = [plugin://plugin.video.netflixbmc/]
23:58:34 T:140568402946112   DEBUG: Loading items: 5, directory: plugin://plugin.video.netflixbmc/?mode=main&thumb&type=movie&url sort method: 0, ascending: false
23:58:34 T:140567946610432  NOTICE: Thread BackgroundLoader start, auto delete: false
23:58:34 T:140567946610432   DEBUG: Thread BackgroundLoader 140567946610432 terminating
23:58:34 T:140568402946112   DEBUG: ------ Window Deinit (DialogProgress.xml) ------
23:58:34 T:140568402946112   DEBUG: ------ Window Deinit (DialogBusy.xml) ------
23:58:35 T:140566406240000   DEBUG: webserver: request received for /jsonrpc
23:58:39 T:140568402946112   DEBUG: Previous line repeats 2 times.
23:58:39 T:140568402946112   DEBUG: ------ Window Deinit (DialogKaiToast.xml) ------
23:58:41 T:140566406240000   DEBUG: webserver: request received for /jsonrpc
guss77 commented 8 years ago

Looks like I have the same problem. I have a new Netflix account, downloaded and installed 1.3.23, and every action I do in the interface (except "Genres", see below) breaks with an error and I get this in the log:

EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                         - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                        Error Type: <type 'exceptions.IndexError'>
                                        Error Contents: list index out of range
                                        Traceback (most recent call last):
                                          File "/home/media/.kodi/addons/plugin.video.netflixbmc/default.py", line 1312, in <module>
                                            listVideos(url, type, runAsWidget)
                                          File "/home/media/.kodi/addons/plugin.video.netflixbmc/default.py", line 276, in listVideos
                                            listVideo(videoID, "", "", False, False, type)
                                          File "/home/media/.kodi/addons/plugin.video.netflixbmc/default.py", line 375, in listVideo
                                            title = match[0].strip()
                                        IndexError: list index out of range
                                        -->End of Python script error report<--

When accessing "Genres" there is no error and I get an empty list. Running Kode 17.0 (alpha) on Ubuntu 15.10 in standalone mode (no window manager)

guss77 commented 8 years ago

The problem seems to be in default.py line 375, where the regular expression tries to match a span that is no longer on the Netflix page. I've worked around the problem by using the regex instead that extract the title from the title card's ARIA label:

id="title-card.*?"[^>]+aria-label="([^"]+)"'
gregbert42 commented 8 years ago

id="title-card.*?"[^>]+aria-label="([^"]+)"' is a syntax error for me. shouldn't it be title = ? (i have the same problem about match[0].strip())