Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception after login #742

Closed
maxberghammer opened this issue Feb 28, 2020 · 25 comments
Closed

Exception after login #742

maxberghammer opened this issue Feb 28, 2020 · 25 comments

Comments

@maxberghammer
Copy link

Today I created a new google-account and wanted to use this account in the youtube-addon. Unfortunately I get an "Youtube-error" after I entered the 2 codes on the google/device-page. Using another (older) account works perfectly, but the newly created one doesn't. The kodi-log says the following:

2020-02-28 15:55:01.432 T:1764770528  NOTICE: [plugin.video.youtube] Running: YouTube (6.6.0) on Leia (Kodi-18.2) with Python 2.7.13
                                            	Path: /
                                            	Params: {}
2020-02-28 15:55:01.852 T:1764770528   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/pi/.kodi/addons/plugin.video.youtube/resources/lib/default.py", line 15, in <module>
                                                runner.run(__provider__)
                                              File "/home/pi/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/runner.py", line 60, in run
                                                __RUNNER__.run(provider, context)
                                              File "/home/pi/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/impl/xbmc/xbmc_runner.py", line 33, in run
                                                results = provider.navigate(context)
                                              File "/home/pi/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/abstract_provider.py", line 99, in navigate
                                                result = method(context, re_match)
                                              File "/home/pi/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/abstract_provider.py", line 132, in _internal_root
                                                return self.on_root(context, re_match)
                                              File "/home/pi/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/provider.py", line 1485, in on_root
                                                playlists = resource_manager.get_related_playlists(channel_id='mine')
                                              File "/home/pi/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/helper/resource_manager.py", line 183, in get_related_playlists
                                                result = self._update_channels([channel_id])
                                              File "/home/pi/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/helper/resource_manager.py", line 50, in _update_channels
                                                channel_id = items[0]['id']
                                            IndexError: list index out of range
                                            -->End of Python script error report<--
2020-02-28 15:55:02.045 T:1472189152   ERROR: GetDirectory - Error getting plugin://plugin.video.youtube/
2020-02-28 15:55:02.051 T:1901990752   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.youtube/) failed

I'm using my own ApiKey (I tried an existing one and one newly created for the new account - makes no difference) and run Kodi 18.2 on a raspi 3B+ with raspian stretch and all updates installed. I already tried subscribing to a youtube-channel, as I thought this would be the problem when I looked at the logs - Still no success. Do I have to change something on my google account?

@Jurik-Phys
Copy link

A few days ago I was created ApiKey and youtube-addon worked fine. But today I got the same error. Update addon and os for last version don't help me. I run Kodi (18.5) on raspberry PI 3B+ with OSMC.

osmc@rpi-room:~/.kodi/temp$ grep Kodi ~/.kodi/temp/kodi.log | head -3
2020-02-28 13:52:17.167 T:1915790896  NOTICE: Starting Kodi (18.5). Platform: Linux ARM (Thumb) 32-bit
2020-02-28 13:52:17.167 T:1915790896  NOTICE: Using Release Kodi x32 build (version for Raspberry Pi)
2020-02-28 13:52:17.167 T:1915790896  NOTICE: Kodi compiled 2020-01-29 by GCC 6.3.0 for Linux ARM (Thumb) 32-bit version 4.9.110 (264558)
osmc@rpi-room:~/.kodi/temp$ grep VERSION_ID /etc/os-release
VERSION_ID="2020.01-2"
2020-02-28 19:58:12.637 T:1516233440  NOTICE: [plugin.video.youtube] Running: YouTube (6.7.0~alpha1) on Leia (Kodi-18.5) with Python 2.7.13
                                                Path: /
                                                Params: {}
2020-02-28 19:58:12.746 T:1516233440   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/osmc/.kodi/addons/plugin.video.youtube/resources/lib/default.py", line 15, in <module>
                                                runner.run(__provider__)
                                              File "/home/osmc/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/runner.py", line 60, in run
                                                __RUNNER__.run(provider, context)
                                              File "/home/osmc/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/impl/xbmc/xbmc_runner.py", line 33, in run
                                                results = provider.navigate(context)
                                              File "/home/osmc/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/abstract_provider.py", line 99, in navigate
                                                result = method(context, re_match)
                                              File "/home/osmc/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/abstract_provider.py", line 132, in _internal_root
                                                return self.on_root(context, re_match)
                                              File "/home/osmc/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/provider.py", line 1486, in on_root
                                                playlists = resource_manager.get_related_playlists(channel_id='mine')
                                              File "/home/osmc/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/helper/resource_manager.py", line 184, in get_related_playlists
                                                result = self._update_channels([channel_id])
                                              File "/home/osmc/.kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/helper/resource_manager.py", line 51, in _update_channels
                                                channel_id = items[0]['id']
                                            IndexError: list index out of range
                                            -->End of Python script error report<--
2020-02-28 19:58:12.955 T:1406120672   ERROR: GetDirectory - Error getting plugin://plugin.video.youtube/
2020-02-28 19:58:12.957 T:1915790896   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.youtube/) failed 

@lsborg
Copy link

lsborg commented Feb 28, 2020

Same error here, kodi 18.5, youtube 6.6.0, librelec, pi 1 model B.

@anxdpanic
Copy link
Collaborator

Can one of you try https://github.com/jdf76/plugin.video.youtube/releases/download/6.7.0-dev/plugin.video.youtube-6.7.0.alpha2.zip and please post the debug log even if it works. I'm unable to reproduce this so I've added logging to see what is being returned in this case, and hopefully find a better solution. Thanks 👍

@guidosarducci
Copy link
Contributor

I too have the same error, also using Kodi 18.5 with Youtube v6.6.0. I am using the same personal API keys I've been successfully using for years. Nothing has changed apart from the most recent update to the addon.

@guidosarducci
Copy link
Contributor

Can one of you try https://github.com/jdf76/plugin.video.youtube/releases/download/6.7.0-dev/plugin.video.youtube-6.7.0.alpha2.zip and please post the debug log even if it works. I'm unable to reproduce this so I've added logging to see what is being returned in this case, and hopefully find a better solution. Thanks +1

@anxdpanic It works without errors. I can see my own subscriptions so it must me authenticating properly. Thanks very much... What changed?

@anxdpanic
Copy link
Collaborator

I'm guessing My Channel doesn't show up for you now though?
I won't know what changed really until I can get a debug log with the alpha2 zip since I'm unable to reproduce.

@guidosarducci
Copy link
Contributor

OK, I tested by selecting 'My Subscriptions', then 'My Channel -> Playlists' (it does show up), and captured the debug log below. Hope that helps.

youtube.log

@anxdpanic
Copy link
Collaborator

Thanks @guidosarducci
It looks like some stuff will likely not work, the logging confirmed it's likely a change to something YouTube's end only affecting some accounts. YouTube normally returns a channel id for for 'mine', which it's unable to find according to the logs.
Will look into it more next chance I get though.

@lsborg
Copy link

lsborg commented Feb 29, 2020

Thanks @anxdpanic the alpha is working here too.

@Jurik-Phys
Copy link

I updated plugin.video.youtube-6.7.0.alpha1 to plugin.video.youtube-6.7.0.alpha2. Authenticating now work properly. I get list of video from "My Subscriptions"/"Мои подписки" and video from this list played. Log attached. Thanks for work!

kodi.log

@Jurik-Phys
Copy link

Jurik-Phys commented Feb 29, 2020

After playing video thourgh one hour and stoped it I don't get list of video from "My Subscriptions"/"Мои подписки". I get only clean list with zero items. Log attached.

ERROR: /home/osmc/.kodi/addons/script.module.urllib3/lib/urllib3/connectionpool.py:1004: 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,
2020-02-29 11:49:18.085 T:1286537952   ERROR: Previous line repeats 15 times.
2020-02-29 11:49:18.085 T:1286537952   ERROR: [plugin.video.youtube] Refresh Failed: Code: |400| JSON: |{u'error_description': u'Token has been expired or revoked.', u'error': u'invalid_grant'}|
2020-02-29 11:49:18.086 T:1286537952   ERROR: [plugin.video.youtube] LoginException: [400] invalid_grant: Token has been expired or revoked.
2020-02-29 11:49:18.214 T:1286537952   ERROR: /home/osmc/.kodi/addons/script.module.urllib3/lib/urllib3/connectionpool.py:1004: 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,
2020-02-29 12:30:23.310 T:1915381296   ERROR: Previous line repeats 233 times.

kodi.log

@maxberghammer
Copy link
Author

maxberghammer commented Feb 29, 2020

@anxdpanic I changed the code in the python-file directly in the way you did it in your alpha. Seems to work perfectly! Thx!

Interestingly no debug-log appears in my log...so I think Youtube changed something again, so that everything works like before their recent changes to some user-profiles...

@anxdpanic
Copy link
Collaborator

@Jurik-Phys
Try Settings - Maintenance - Reset access manager
if that fails Settings - Maintenance - Delete access_manager.json
if that fails manually delete userdata/addon_data/plugin.video.youtube/access_manager.json

@Jurik-Phys
Copy link

Jurik-Phys commented Feb 29, 2020

Try Settings - Maintenance - Reset access manager

After reset I did two stage authorization and list of video worked. Thanks!

@lameventanas
Copy link

@anxdpanic I have the same problem here, and I don't see any Maintenance under Settings.

@anxdpanic
Copy link
Collaborator

@lameventanas It's there you just need to scroll the categories.

@lameventanas
Copy link

I'm using Kodi 18.5 with the Confluence theme.
Under Settings I have: Player, Media, Games, PVR & Live TV, Add-ons, Service, Interface and System.

@anxdpanic
Copy link
Collaborator

You need to open the Context Menu or Information, on the YouTube add-on and choose Settings there.

@lameventanas
Copy link

Oh I see, I thought it was a global cache thing that had to be reset.

Is there a way to prevent this in the future or make it more automatic? Maybe by more checks on what is returned by Youtube?

@anxdpanic
Copy link
Collaborator

Without the debug log, I don't even know what issue you were experiencing.

@lameventanas
Copy link

My debug log looks exactly like the one posted here, eg: IndexError: list index out of range after json_data.get() returns an empty list and there is no check for that.

@anxdpanic
Copy link
Collaborator

Ah, that was fixed in the alphas. So I didn't think of Maintenance being related to that

Up until recently this area of code worked for everyone, YouTube made a change and now the same information isn't available for all accounts. This caused the error.
But yes, it is already fixed.

You can find the beta https://github.com/jdf76/plugin.video.youtube/releases/tag/6.7.0-dev

@lameventanas
Copy link

Thanks!
If I want to backport it, can i just apply ed1e160 or is it more complicated than this?

@anxdpanic
Copy link
Collaborator

that's all that is required for that particular fix

@lameventanas
Copy link

Thanks for your prompt communication, and great work in this addon. It is working now :)
I'm looking forward to 6.7 being released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants