khloke / play-to-xbmc-chrome

A Google Chrome Extension for sending online content to be played on XBMC. Supported websites include YouTube, Vimeo, CollegeHumor, DailyMotion, eBaumsWorld and SoundCloud.
MIT License
186 stars 112 forks source link

Twitch Beta doesn't work #126

Closed attmayMB closed 6 years ago

attmayMB commented 7 years ago

Twitch has a beta with a new URL, https://go.twitch.tv/USERNAME

It is likely that Twitch is going to keep the "go" after the beta is completed, so this request is to support the "go" URL as the regular Twitch URL has worked.

khloke commented 7 years ago

Twitch didn't only change the URL, they also changed their site code and made it impossible (as far as I've looked) to get the channel ID from the page alone. Without the channel ID, I can't play a live stream. I'll have to investigate other methods to do this.

attmayMB commented 7 years ago

Ah, too bad. I was hoping it was something simple. Thank you for looking into it!

lephisto commented 6 years ago

Twitch support is fully broken now, i'll try to dig into this, but i'm not familiar with Chrome Extension development. This is what my kodi spits out:

19:11:48.461 T:1440551680 NOTICE: Twitch: Calling |play| for mode |play| with pos args |[]| and kwargs |{'channel_id': 'undefined'}| 19:11:48.461 T:1440551680 WARNING: Twitch: Warning: Arguments |{'name': '99damage'}| were passed but unused by |play| for mode |play| 19:11:48.848 T:1440551680 ERROR: Twitch: Error |Bad Request| |[400] The parameter "id" was malformed: the value must match the regular expression /^[0-9]+$/| 19:11:48.916 T:1911640064 ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.twitch/?mode=play&channel_id=undefined&name=99damage]

khloke commented 6 years ago

The problems comes from the channel_id. The twitch add-on takes a channel_id to play live videos, and the twitch page used to have this information buried in the HTML, but not anymore. There are other methods but would require more time to experiment with.

lephisto commented 6 years ago

Yes i digged into that, but didn't find a way or any call in twitchs api5 to retrieve channelId by channelName... :(

antoine-morisseau commented 6 years ago

Since the twitch api required an api key in order to use their api, i think the best way is for Twitch Add-on to allow external software like this one to request to start a stream by giving a channel name. I created a feature request on their side to find if it's doable on their side.

anxdpanic commented 6 years ago

@khloke The Twitch add-on will handle channel_name in the play route for the next release. https://github.com/MrSprigster/Twitch-on-Kodi/releases/tag/2.1.0-alpha

khloke commented 6 years ago

@anxdpanic That's awesome. This will solve the problem.

lephisto commented 6 years ago

Installed 2.1.0-alpha - still the same.

antoine-morisseau commented 6 years ago

Well i don't know how the play-to-xbmc-chrome work for Twitch but if it call the Twitch add-on use channel_name instead of name in the query to kodi ?

I don't search too much in the repository, maybe @khloke could answer this question more quickly :)

antoine-morisseau commented 6 years ago

@khloke and @lephisto Allright, i solved the issue.

in the module.js at line 649 the action doesn't work anymore to retrieve the channel_id so i did this :

    if (versionNumber >= 2.0) {
        if (liveVideo) {
            callback('plugin://plugin.video.twitch/?mode=play&channel_name=' + videoId);
        } else {
            callback('plugin://plugin.video.twitch/?mode=play&video_id=' + videoId);
        }

and now it work like a charm with the 2.1.0-alpha 7

lephisto commented 6 years ago

@antoine-morisseau Ah that does the trick. PR?

khloke commented 6 years ago

Awesome, I'll review and merge it soon.

antoine-morisseau commented 6 years ago

Maybe wait the full release of @anxdpanic twitch add-on 2.1.0 version that include the channel_name fonctionnality ?

anxdpanic commented 6 years ago

2.1.0 is PR'd to official repository, pending review

anxdpanic commented 6 years ago

2.1.0 is on official now. Will be changing to helix api in next version. Look up by name is still possible with the helix api, so I don't expect any changes will be required here. 👍

parasyte commented 6 years ago

Twitch support no longer works with the Twitch 2.1.0 add-on.

17:15:23.444 T:1466954656 WARNING: script.module.python.twitch: API version |V5| is deprecated, update to |Helix| by |2/14/18|
17:15:23.896 T:1466954656  NOTICE: Twitch: Calling |play| for mode |play| with pos args |[]| and kwargs |{'channel_id': 'undefined'}|
17:15:23.896 T:1466954656 WARNING: Twitch: Warning: Arguments |{'name': 'andy'}| were passed but unused by |play| for mode |play|
17:15:24.182 T:1466954656   ERROR: Twitch: Error |Bad Request| |[400] The parameter "id" was malformed: the value must match the regular expression /^[0-9]+$/|
17:15:24.273 T:1947242512   ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.twitch/?mode=play&channel_id=undefined&name=andy]

I manually patched https://github.com/khloke/play-to-xbmc-chrome/commit/5f966a6a4ac37a9dc380a6e5bc4374086f22894c into the extension with Chrome Dev Tools as a workaround.

antoine-morisseau commented 6 years ago

Hello, since the merge has been done and the version number has been bumped. Do you know when it will be available/deployed on the Chrome Web Store @khloke ? :)

khloke commented 6 years ago

Released.