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

Twitch API v5 shutdown #615

Closed
apo86 opened this issue Feb 9, 2022 · 107 comments
Closed

Twitch API v5 shutdown #615

apo86 opened this issue Feb 9, 2022 · 107 comments

Comments

@apo86
Copy link
Contributor

apo86 commented Feb 9, 2022

So, I don't know if anyone has this on their radar, because I certainly didn't, but it looks like the addon is not going to work after end of the month unless some (many? most?) API calls are changed.

In fact it has already started with some scheduled downtimes that one or the other might have noticed Monday and today. As per Twitch's timeline those downtimes will increase until the final shutdown on the 28th:
https://blog.twitch.tv/en/2021/07/15/legacy-twitch-api-v5-shutdown-details-and-timeline/

I can try to begin figuring out what needs to be changed, but honestly I don't know if I'm up to the task. And I also don't know if this even is a "simple" 1:1 migration to the new API or if more significant changes are needed because Twitch might've changed or even cut some functionality.

So uh, @anxdpanic if you are out there: Help, please?

@anxdpanic
Copy link
Owner

It's absolutely on my radar, we will likely lose some functionality. But I will be trying to get some of the migration underway.

@apo86
Copy link
Contributor Author

apo86 commented Feb 9, 2022

That's good to hear, thanks! If there's anything I can do to help please let me know. I'm only lacking competence, not motivation ;)

@anxdpanic
Copy link
Owner

@apo86 or anyone else looking to help, or follow,
I'll be tracking the updates on https://github.com/anxdpanic/plugin.video.twitch/tree/helix_api

The changes to https://github.com/anxdpanic/script.module.python.twitch won't be breaking, so those can be tracked in master

@anxdpanic
Copy link
Owner

I'd estimate about half way there, it looks like we'll probably lose blacklist (at least until it can be revisited in the future), but may get to add the chat back using IRC. Will find out for sure as I get further.

@neo-neo1
Copy link

neo-neo1 commented Feb 14, 2022

Looks like we’re screwed currently. Twitch v5 API is currently in a planned 4 hour shutdown block with many more planned rolling shutdowns until the final death day Feb 22.

@anxdpanic
Copy link
Owner

That's why I'm trying to keep everyone posted here. Once something usable for testing is ready I will post everything needed as well.

@neo-neo1
Copy link

neo-neo1 commented Feb 14, 2022

That's why I'm trying to keep everyone posted here. Once something usable for testing is ready I will post everything needed as well.

Thanks for your work. I hope to see Kodi 18 support continued since many still can not run Kodi 19. LibreELEC is a big one as they have yet to add Kodi 19 support to Rasp Pi 3B and many other popular boards. Thanks again.

@anxdpanic
Copy link
Owner

No reason to change Kodi compatibility at this moment, so the helix update will be for the same versions of Kodi.

@apo86
Copy link
Contributor Author

apo86 commented Feb 14, 2022

I'd estimate about half way there, it looks like we'll probably lose blacklist (at least until it can be revisited in the future), but may get to add the chat back using IRC. Will find out for sure as I get further.

Sounds promising, thanks for your efforts!

@kcs32787github
Copy link

I'd estimate about half way there, it looks like we'll probably lose blacklist (at least until it can be revisited in the future), but may get to add the chat back using IRC. Will find out for sure as I get further.

Thanks for all you do with this addon. I would be completely lost without it :)

@MrSprigster
Copy link
Collaborator

@anxdpanic Thank you for your continued efforts, it is much appreciated by a silent many, myself included.

Sprig

@MrSprigster
Copy link
Collaborator

MrSprigster commented Feb 14, 2022

For anyone currently experiencing add-on issues:

Twitch API v5 phased shutdown schedule:

February 7, 2022 – 1-hour shutdown starting at 11:00am PDT
February 9, 2022 – 2-hour shutdown starting at 11:00am PDT
February 14, 2022 – 4-hour shutdown starting at 11:00am PDT
February 16, 2022 – 6-hour shutdown starting at 11:00am PDT
February 22, 2022 – 24-hour shutdown starting at 11:00am PDT
February 28, 2022 – v5 permanent shutdown

@pitsi
Copy link

pitsi commented Feb 15, 2022

@MrSprigster
Thank you very much for posting the schedule. 11am pdt is 9pm for me here at gmt+2, which means that it stops working just when my day is over and I lay down and watch some twitch to relax. And I am probably sleeping when it comes back up.
As it seems, next Tuesday, February 22nd, will be a tough day for me :P

@anxdpanic
Can you please upload any development version of the addon in your "twitch development repository"? Alpha, beta, anything is welcome as long as it can play vods or live streams!

@anxdpanic
Copy link
Owner

@pitsi
That's the plan, and I do hope to have something up before the outage tomorrow. It might only be the 'Following' section but should be usable.

@pitsi
Copy link

pitsi commented Feb 15, 2022

Oh, there is an outage planned for tomorrow. I forgot about it.
I do not have a twitch account, thus I have no use for the "following" section. I just check games or streamers, which I keep as favorites inside kodi.

@anxdpanic
Copy link
Owner

Favorited streams should work in that case, I have followed stuff 'working' and didn't have to change the playback route, so anything favorite pointing to something playable should work once I have something up.

@pitsi
Copy link

pitsi commented Feb 15, 2022

Thank you for the clarification.
What if the favorite does not link to something directly playable but to a list instead, e.g. the streams of a game or the vods of a streamer?

@anxdpanic
Copy link
Owner

anxdpanic commented Feb 15, 2022

That will be hit or miss, depends on how much I can get done today before I push the alpha 👍
edit: Some of those favorites will have to be recreated though, some routes have already changed due to the api changes.

@pitsi
Copy link

pitsi commented Feb 15, 2022

Thank you :)
God I hate api changes (regardless of platform)!

@anxdpanic
Copy link
Owner

Not sure if I'll get back to it today, but I have it 90%+ working but completely broken on Kodi 19+.
Hopefully later tonight or tomorrow morning I'll be able to get that working and push a version to the test repositories.
Thanks for your patience 😄

@anxdpanic
Copy link
Owner

Well it looks like it was my portable v19 install that was the issue.

Zips can be found here: (install python.twitch first)
https://github.com/anxdpanic/script.module.python.twitch/releases/tag/2.0.21-dev
https://github.com/anxdpanic/plugin.video.twitch/releases/tag/2.6.0-dev

I'll work on getting them pushed to the development repository next.

@anxdpanic
Copy link
Owner

Development repository should contain the latest alpha versions.

If there are any issues with the alphas please open a new issue so it's easier to track.

We can continue with everything else in this thread

😄

@Lookens
Copy link

Lookens commented Feb 16, 2022

Thanks for you work, everything is good for me now !

@kevinackroyd
Copy link

Working fine for me too, thanks for all your amazing work.
BTW, Anyone wanting to login will need to generate a new OAuth token using the link on the settings page.

@apo86
Copy link
Contributor Author

apo86 commented Feb 16, 2022

Thanks, amazing work! All the main functionality looks good to me.

@MrSprigster
Copy link
Collaborator

@anxdpanic Legend. Thanks again!

@jonisb
Copy link

jonisb commented Feb 16, 2022

Thanks for the updates
I tried a live stream and a VOD both worked, there are some details like VOD length that are incorrect but I'm guessing they are not finished yet.

Very much appreciated. 👍

@neo-neo1
Copy link

Working great here. While you’re under the hood please consider adding Add to Queue feature. If possible would be greatly appreciated. Thanks

@kcs32787github
Copy link

3/3 on my installs. Working perfectly! Thanks for the quick work and getting up to date before the death of v5 api!

@neo-neo1
Copy link

Had an initial issue with beta6 but solved it by uninstalling and installing. Hope this helps someone.

@pitsi
Copy link

pitsi commented Feb 20, 2022

I can see that being frustrating. Kodi is probably seeing the version of the add-on from the addons/packages/ folder where Kodi downloads the zips to.

I thought about it too, but the ~/.kodi/addons/pacages folder is cleaned on every boot via autostart.sh

# cat .config/autostart.sh | grep packages
rm /storage/.kodi/addons/packages/*.zip

And oddly enough, the versions that are re-downloaded in there on each boot are the ones that come from the main repo.

# ls .kodi/addons/packages/
plugin.video.twitch-2.5.12.zip          script.module.python.twitch-2.0.19.zip

I will post at the thread on kodi's forum, in case some dev can find the reason.

@anxdpanic
Copy link
Owner

I've submitted the add-ons to the official repository for review. Thank you everyone for your testing, feedback and patience!

@fragande
Copy link

I've submitted the add-ons to the official repository for review. Thank you everyone for your testing, feedback and patience!

Thank you for your continued efforts 🙇‍♂️

@apo86
Copy link
Contributor Author

apo86 commented Feb 21, 2022

I've submitted the add-ons to the official repository for review. Thank you everyone for your testing, feedback and patience!

Thank you for everything, we would've been completely lost without you!

@cmsimike
Copy link

Thank you!

@cmsimike
Copy link

This might be a problem on my end, but I am trying to manually update the Twitch plugin. The version in matrix says that it is 2.6.0+matrix.1 but when I load the addon I get an exception

2022-02-22 15:27:58.552 T:7181     INFO <general>: initializing python engine.
2022-02-22 15:27:58.603 T:7153     INFO <general>: Python interpreter stopped
2022-02-22 15:27:58.923 T:7181  WARNING <general>: script.module.python.twitch: API version |V5| is deprecated, update to |Helix| by |TBD|
2022-02-22 15:27:59.260 T:7181    ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'AttributeError'>
                                                   Error Contents: module 'twitch.oauth.helix.scopes' has no attribute 'user_read_follows'
                                                   Traceback (most recent call last):
                                                     File "/home/mike/.kodi/addons/plugin.video.twitch/resources/lib/addon_runner.py", line 13, in <module>
                                                       from twitch_addon import router
                                                     File "/home/mike/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/router.py", line 14, in <module>
                                                       from .addon import api
                                                     File "/home/mike/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/addon/api.py", line 15, in <module>
                                                       from . import cache, utils
                                                     File "/home/mike/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/addon/utils.py", line 24, in <module>
                                                       from .constants import CLIENT_ID, REDIRECT_URI, LIVE_PREVIEW_TEMPLATE, Images, ADDON_DATA_DIR, COLORS, Keys
                                                     File "/home/mike/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/addon/constants.py", line 208, in <module>
                                                       SCOPES = [scopes.user_read_follows, scopes.user_edit_follows, scopes.user_read_subscriptions,
                                                   AttributeError: module 'twitch.oauth.helix.scopes' has no attribute 'user_read_follows'
                                                   -->End of Python script error report<--

I tried clearing out my addon data, but I am still getting this error. Thoughts?

@anxdpanic
Copy link
Owner

@cmsimike https://github.com/anxdpanic/script.module.python.twitch/releases/tag/v2.0.21

@cmsimike
Copy link

@anxdpanic Thank you - just figured it out and came here to update the thread. Indeed this was the issue. Forgot there was this script that needed to be updated. THANKS AGAIN!

@Guerretto
Copy link

Neither on Raspi4

@beigexperience
Copy link

Thanks for the timely update. I just updated the addon from the repo and it works fine on a raspi3b running libreelec

@Guerretto
Copy link

Confirmed, works again

@pitsi
Copy link

pitsi commented Feb 25, 2022

Happening now on my end. Main pc running kodi 19.3 on debian testing/unstable x64 and twitch 2.5.12 from the main repo (= the dev repo is not installed here).

2022-02-25 11:18:43.283 T:3502    ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ModuleNotFoundError'>
                                                   Error Contents: No module named 'twitch.oauth.v5'
                                                   Traceback (most recent call last):
                                                     File "/home/user/.kodi/addons/plugin.video.twitch/resources/lib/service_runner.py", line 12, in <module>
                                                       from twitch_addon import service
                                                     File "/home/user/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/service.py", line 21, in <module>
                                                       from .addon.constants import Keys
                                                     File "/home/user/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/addon/constants.py", line 14, in <module>
                                                       from twitch.oauth.v5 import scopes
                                                   ModuleNotFoundError: No module named 'twitch.oauth.v5'
                                                   -->End of Python script error report<--

If it helps. I got a minor update on python3 3.9.10 (3.9.10-1 to 3.9.10-2) and this tiny bit is mentioned in the changelog.
* Make test suite support Expat >=2.4.5.

If it is an api issue, please tell me. If it is a python issue, ignore the above. I am now used to addons breaking because of the python updates of my distro.
No issues on the libreelec 9.2.6 x64 installation that has the same version of twitch... and python2.

@anxdpanic
Copy link
Owner

@pitsi script.module.python.twitch has been reviewed and merged to official repo first (as required), so you'll have to rollback the python.twitch version.

@pitsi
Copy link

pitsi commented Feb 25, 2022

You are right, python-twitch was upgraded to 2.0.21 under my nose :P

$ cat .kodi/addons/*.twitch/addon.xml | grep "addon id"
<addon id="plugin.video.twitch" version="2.5.12+matrix.1" name="Twitch" provider-name="anxdpanic, A Talented Community">
<addon id="script.module.python.twitch" name="python-twitch for Kodi" version="2.0.21+matrix.1" provider-name="anxdpanic, A Talented Community">

I will do the downgrade later in the day. If you have to move twitch 2.6.0 to the main repo, please do so.

@Slizbury
Copy link

Upgrading to the latest version of the Twitch plugin (2.6.0+matrix.1) has restored functionality of the plugin for me, but the "Browse" option is now missing. I only see my "Following" people and a "Search" option, but the "Browse" option (and I think maybe one or two others) is gone. Hopefully that can come back at some point.

I know this is all in mid-development with the API switch, and I appreciate the effort that has been taken to get things working with the new API! Just wanted to give some feedback on what I was seeing after my upgrade.

@THeXES
Copy link

THeXES commented Feb 26, 2022

When I put the link I get "Dynamic Link Not Found", is there any solution to this?

@MrSprigster
Copy link
Collaborator

The link is case sensitive. Included below for your convenience.

https://twitchaddon.page.link/Z1iP

@M-Reimer
Copy link
Contributor

M-Reimer commented Feb 26, 2022

If I try to click "Get OAuth token", then a message pops up telling "Failed to connect to Twitch API" and I have this in my logs:

2022-02-26 13:25:48.972 T:537      INFO <general>: initializing python engine.
2022-02-26 13:25:50.032 T:537     ERROR <general>: Traceback (most recent call last):
                                                   
2022-02-26 13:25:50.032 T:537     ERROR <general>: 
2022-02-26 13:25:50.032 T:537     ERROR <general>:   File "/var/lib/kodi/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/router.py", line 290, in run
                                                       twitch_api = api.Twitch()
                                                   
2022-02-26 13:25:50.032 T:537     ERROR <general>: 
2022-02-26 13:25:50.032 T:537     ERROR <general>:   File "/var/lib/kodi/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/addon/api.py", line 54, in __init__
                                                       if not self.valid_token(self.client_id, self.access_token, self.required_scopes):
                                                   
2022-02-26 13:25:50.032 T:537     ERROR <general>: 
2022-02-26 13:25:50.032 T:537     ERROR <general>:   File "/var/lib/kodi/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/addon/common/cache.py", line 104, in memoizer
                                                       result = func(*args, **kwargs)
                                                   
2022-02-26 13:25:50.032 T:537     ERROR <general>: 
2022-02-26 13:25:50.032 T:537     ERROR <general>:   File "/var/lib/kodi/.kodi/addons/plugin.video.twitch/resources/lib/twitch_addon/addon/api.py", line 62, in valid_token
                                                       if token_check['client_id'] == self.client_id:
                                                   
2022-02-26 13:25:50.032 T:537     ERROR <general>: 
2022-02-26 13:25:50.032 T:537     ERROR <general>: KeyError: 'client_id'
                                                   
2022-02-26 13:25:50.032 T:537     ERROR <general>: 
2022-02-26 13:25:50.032 T:537     ERROR <general>: Twitch: None
2022-02-26 13:25:50.032 T:537      INFO <general>: CPythonInvoker(9, /var/lib/kodi/.kodi/addons/plugin.video.twitch/resources/lib/addon_runner.py): script successfully run
2022-02-26 13:25:50.059 T:537      INFO <general>: Python interpreter stopped

Edit: This happens if you once entered an invalid OAuth token. The only way to enter a new one is to use "Defaults" in the settings to get rid of the invalid token first.

Works for me now but I had to manually install. Does not come from the addon repo, so far. Thank you for the fix!

@pitsi
Copy link

pitsi commented Feb 27, 2022

To the ones that do NOT use the dev repo and get the updates from the main one only.
How does your twitch 2.5.12 cope with the new python-twitch 2.0.21 (because these are the latest versions provided from the main repo)?
Mine pops up the error above and downgrading python-twitch to make it work (and keep it downgraded until March 1st) is a pita.

@QMaxy
Copy link

QMaxy commented Feb 28, 2022

How does your twitch 2.5.12 cope with the new python-twitch 2.0.21 (because these are the latest versions provided from the main repo)?

Using only the main repo I've received python-twich 2.0.21 update, but Twich add-on till remain to 2.5.12 release. This combination doesn't work with pop-up error everytime Kodi starts.
I tried manually downgrading python-twich to 2.0.19 and all works fine, but the next time I started Kodi, python-twich has been auto-upgraded to .21 and, again it doesn't work.
Next, I downloaded Twich add-on 2.6.0 from here (not yet available from main depo), obtained my OAuthed token, and now all seems working fine.

@pitsi
Copy link

pitsi commented Mar 1, 2022

Same thing here then.

@anxdpanic
Now that api v5 is dead, along with twitch 2.5, can you please push twitch 2.6 to the main repo?

@anxdpanic
Copy link
Owner

@pitsi It was submitted to the official repository ~8days ago. It needed to be reviewed by another Team member when they have time before it could be merged.

Looks like it's been reviewed and merged on matrix, lower versions will follow later today.

@pitsi
Copy link

pitsi commented Mar 1, 2022

Yea, I remember you saying about submitting it. I checked like ~1 hour ago and both leia and matrix were on 2.5.x. Now matrix is on 2.6.0.

---edit
I finally got it to work again! The good news is that I did not have to reset settings or remove anything at all, so all my favorites are still there and working! The bad news is that when selecting "get oauth token" or "oauth token" below it in my kodi 19.3, the entire kodi crashes. I blame my distro's python 3.9.x for that because it happens with other addons too. I will post a log when I have time.
I managed to put it there by using "send text to kodi" through the web interface. Kodi crashed again, but at least the oauth key was stored.

@anxdpanic
Copy link
Owner

Everything has been merged to the official repository now. I'll close this issue now in favor of specific issues encountered with the new version.

Thanks again everyone!

@fossdd
Copy link

fossdd commented Mar 2, 2022

Thank you guys, I can verify the latest version works perfectly!

@dgiglio
Copy link

dgiglio commented Apr 3, 2022

Hi @anxdpanic
first of all, thanks for your work. I'm encountering this issue:
I can watch Twitch on Kodi 19.x using the 2.6 plugin version on a AMD64 architecture.
I cannot do the same on my Raspberry4 with a 32bit Debian, since the official Kodi repo still provides the deprecated 2.5.x plugin version only.
How can I force an upgrade? Can I proceed installing directly the zip?
Thanks in advance

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

No branches or pull requests