TheAssassin / kodi-invidious-plugin

Invidious plugin for Kodi. A privacy-friendly way of viewing YouTube videos, built using the awesome Invidious service's API.
MIT License
50 stars 16 forks source link

Cannot search for videos #17

Closed ghost closed 1 year ago

ghost commented 2 years ago

Whenever I search for a video to play in any instance the same problem occurs. Here is the log

2022-07-11 14:56:45.791 T:19384    INFO <general>: initializing python engine.
2022-07-11 14:56:49.516 T:19384   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'KeyError'>
                                                   Error Contents: 'videoThumbnails'
                                                   Traceback (most recent call last):
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py", line 18, in <module>
                                                       sys.exit(main())
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py", line 14, in main
                                                       return plugin.run()
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_plugin.py", line 160, in run
                                                       self.display_search()
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_plugin.py", line 85, in display_search
                                                       self.display_list_of_videos(results)
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_plugin.py", line 47, in display_list_of_videos
                                                       for video in videos:
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_api.py", line 50, in parse_video_list_response
                                                       for thumb in video["videoThumbnails"]:
                                                   KeyError: 'videoThumbnails'
                                                   -->End of Python script error report<--

2022-07-11 14:56:49.530 T:19384    INFO <general>: Python interpreter stopped
2022-07-11 14:56:49.547 T:19383   ERROR <general>: GetDirectory - Error getting plugin://plugin.video.invidious/?action=search_video
2022-07-11 14:56:49.549 T:19044   ERROR <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.video.invidious/?action=search_video) failed
2022-07-11 14:56:49.554 T:19414    INFO <general>: initializing python engine.
2022-07-11 14:56:49.633 T:19414    INFO <general>: CPythonInvoker(8, /home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py): script aborted
2022-07-11 14:56:49.641 T:19414    INFO <general>: Python interpreter stopped
2022-07-11 14:56:51.207 T:19424    INFO <general>: initializing python engine.
2022-07-11 14:56:55.818 T:19424   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'KeyError'>
                                                   Error Contents: 'videoThumbnails'
                                                   Traceback (most recent call last):
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py", line 18, in <module>
                                                       sys.exit(main())
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py", line 14, in main
                                                       return plugin.run()
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_plugin.py", line 160, in run
                                                       self.display_search()
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_plugin.py", line 85, in display_search
                                                       self.display_list_of_videos(results)
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_plugin.py", line 47, in display_list_of_videos
                                                       for video in videos:
                                                     File "/home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_api.py", line 50, in parse_video_list_response
                                                       for thumb in video["videoThumbnails"]:
                                                   KeyError: 'videoThumbnails'
                                                   -->End of Python script error report<--

2022-07-11 14:56:55.846 T:19424    INFO <general>: Python interpreter stopped
2022-07-11 14:56:55.846 T:19423   ERROR <general>: GetDirectory - Error getting plugin://plugin.video.invidious/?action=search_video
2022-07-11 14:56:55.849 T:19044   ERROR <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.video.invidious/?action=search_video) failed
2022-07-11 14:56:55.858 T:19462    INFO <general>: initializing python engine.
2022-07-11 14:56:55.937 T:19462    INFO <general>: CPythonInvoker(10, /home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py): script aborted
2022-07-11 14:56:55.944 T:19462    INFO <general>: Python interpreter stopped
2022-07-11 14:56:57.492 T:19479    INFO <general>: initializing python engine.
2022-07-11 14:57:02.935 T:19479    INFO <general>: CPythonInvoker(11, /home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py): script aborted
2022-07-11 14:57:02.943 T:19479    INFO <general>: Python interpreter stopped
2022-07-11 14:57:05.139 T:19532    INFO <general>: initializing python engine.
2022-07-11 14:57:05.226 T:19532    INFO <general>: CPythonInvoker(12, /home/user/.kodi/addons/plugin.video.invidious/resources/lib/invidious_addon.py): script aborted
2022-07-11 14:57:05.233 T:19532    INFO <general>: Python interpreter stopped
r7l commented 2 years ago

I have the same issue. For some odd reason, it does work when searching for very short words like bla but it doesn't for blabla. The limit seems to be at 4 characters. Anything above causes the error posted above.

I am using the latest version of Libreelec with the plugin installed from repository.

vibrys commented 2 years ago

Hi. I'm experiencing the same

AymericAbrac commented 2 years ago

same here

marysiamzawka commented 2 years ago

Got the issue occuring the same way as OP does, even the logs check out. But so far the plugin returned search results for one long string, that being english ben chaos mod, so the issue may not be related to long strings at all.

At the time of posting the Trending and Popular tabs work flawlessly.

amihajlovic commented 1 year ago

Seems plugin cannot handle search responses which include channels in the results. Channels have different structure and dictionary lookup throws an exception while looking up values using non existing keys. I've made a PR with the fix: https://github.com/TheAssassin/kodi-invidious-plugin/pull/21

You can also fix this on your own instance manually. Open .kodi/addons/plugin.video.invidious/resources/lib/invidious_api.py with your favorite text editor and change

def parse_video_list_response(self, response):
        data = response.json()

        for video in data: 

to

def parse_video_list_response(self, response):
        data = response.json()

        if not video["type"] == "video":
                continue
        for video in data:
eisenherzz commented 1 year ago

Hi, I use this plugin on kodi 20.1 and cannot search strings more than 3 characters. I had time today and just wanted to have a quick look in the source, just to find out somebody already fixed it ;) (Long ago) . This is great!! BUT as far as I can see it was never released in the official repo (https://kodi.tv/addons/nexus/plugin.video.invidious/). @TheAssassin could you please also release there? This would be great!