mintsoft / kodi.plugin.ytchannels

kodi.plugin.ytchannels
GNU General Public License v3.0
5 stars 8 forks source link

Can't search for channels or add by name #46

Closed m-sundman closed 3 months ago

m-sundman commented 4 months ago

Selecting "add channel to root" and then either by name or trying to search for something results in an error message telling me to check the logs. Here's some log:

2024-02-27 00:20:30.661 T:1668    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'urllib.error.HTTPError'>
                                                   Error Contents: HTTP Error 400: Bad Request
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/default.py", line 4, in <module>
                                                       ytchannels_main()
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/resources/lib/ytchannels.py", line 382, in ytchannels_main
                                                       help_list=search_channel_by_username(channel_name)
                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/resources/lib/functions.py", line 363, in search_channel_by_username
                                                       read = read_url(req_url)
                                                              ^^^^^^^^^^^^^^^^^
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/resources/lib/functions.py", line 188, in read_url
                                                       response = urllib.request.urlopen(req)
                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/usr/lib/python3.11/urllib/request.py", line 216, in urlopen
                                                     File "/usr/lib/python3.11/urllib/request.py", line 525, in open
                                                     File "/usr/lib/python3.11/urllib/request.py", line 634, in http_response
                                                     File "/usr/lib/python3.11/urllib/request.py", line 563, in error
                                                     File "/usr/lib/python3.11/urllib/request.py", line 496, in _call_chain
                                                     File "/usr/lib/python3.11/urllib/request.py", line 643, in http_error_default
                                                   urllib.error.HTTPError: HTTP Error 400: Bad Request
                                                   -->End of Python script error report<--
m-sundman commented 4 months ago

And searching:

2024-02-27 00:20:09.681 T:1655    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'urllib.error.HTTPError'>
                                                   Error Contents: HTTP Error 400: Bad Request
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/default.py", line 4, in <module>
                                                       ytchannels_main()
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/resources/lib/ytchannels.py", line 358, in ytchannels_main
                                                       results=search_channel(channel_name)
                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/resources/lib/functions.py", line 338, in search_channel
                                                       read = read_url(req_url)
                                                              ^^^^^^^^^^^^^^^^^
                                                     File "/storage/.kodi/addons/plugin.video.ytchannels/resources/lib/functions.py", line 188, in read_url
                                                       response = urllib.request.urlopen(req)
                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/usr/lib/python3.11/urllib/request.py", line 216, in urlopen
                                                     File "/usr/lib/python3.11/urllib/request.py", line 525, in open
                                                     File "/usr/lib/python3.11/urllib/request.py", line 634, in http_response
                                                     File "/usr/lib/python3.11/urllib/request.py", line 563, in error
                                                     File "/usr/lib/python3.11/urllib/request.py", line 496, in _call_chain
                                                     File "/usr/lib/python3.11/urllib/request.py", line 643, in http_error_default
                                                   urllib.error.HTTPError: HTTP Error 400: Bad Request
                                                   -->End of Python script error report<--
m-sundman commented 4 months ago

Manually opening https://www.googleapis.com/youtube/v3/search?q=mysearchterm&type=channel&part=snippet&maxResults=5&key=MyApiKey in my browser works just fine.

mintsoft commented 4 months ago

Hmm! That's interesting, I've just rechecked on a few installs here and it's not a problem that I'm experiencing.

Do you have any VPNs or proxies etc that could be getting in the way? What version of KODI and ytchannels do you have on? What OS is this running under?

Have you configured the YouTube API key in the addon settings? It should have asked you to do that when you opened it for the first time

m-sundman commented 3 months ago

Do you have any VPNs or proxies etc that could be getting in the way?

Nope.

What version of KODI and ytchannels do you have on?

Newest up-to-date.

What OS is this running under?

CoreELEC

Have you configured the YouTube API key in the addon settings? It should have asked you to do that when you opened it for the first time

Yes. And when it just caused this problem I also tried adding the API key (and client ID and secret) in the file according to the link that the installation instructions told to follow.

mintsoft commented 3 months ago

Hmm! Very interesting. Does the normal Youtube addon work with the same API key?

Also what locale/language is being used? I know there are users using polish and russian character sets without issue, but I'm wondering if this could be an encoding issue of some description. What channel/channels specifically are you searching for?

I don't have any hardware that can run CoreElec that I can test on unfortunately, but my main install uses LibreElec which should be identical, excluding any x86/arm differences (which I can't imagine how, but you never know).

mintsoft commented 3 months ago

I'm going to close this for now because I cannot reproduce this at all; if anyone else experiences this issue I'll happily take another look or add more debugging info, but I'm at a loss at the moment.