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

Allow 'Queue playlist' for youtube mixes #80

Open TimDykes opened 8 years ago

TimDykes commented 8 years ago

If I create a playlist on youtube, I can then open that playlist and queue it to be played via kodi no problem. However, youtube 'Mixes' - its own automatically generated playlists, cant be queued in this way. Usually they are called 'My Mix' or some thing like 'Mix - Artist Name', and clicking "queue playlist" does nothing when on one of these playlists.

Is it possible to have support for playing Youtube Mixes to kodi?

mattvonrocketstein commented 7 years ago

Any update on this?

Itja commented 7 years ago

I just investigated a bit into this issue.

There are two cases of 'Mixes' on Youtube. The 'Mix' based on an Artist or Track, and the 'My Mix', based on your personal watch (or better listening) preferences. For either, the mix is unlike a normal playlist. It's an infinite playlist that is generated as the YouTube website plays the videos.

Artist-Based Mix

This seems to be partially supported by Play to Kodi: I just tested it for one mix generated by YouTube and it only returned the first 26 Items, albeit 50 have been requested. Scrolling further down on the youtube page forcing it to generate more didn't change the output of the API though. So in this case, it needs to be investigated whether it is possible to request further entries of this infinite list, and a strategy of when to request and transmit new entries to Kodi needs to be worked out.

My Mix

In this case, requesting the API with the List ID gives a 404 with this content:

{
 "error": {
  "errors": [
   {
    "domain": "youtube.playlistItem",
    "reason": "playlistNotFound",
    "message": "The playlist identified with the requests \u003ccode\u003eplaylistId\u003c/code\u003e parameter cannot be found.",
    "locationType": "parameter",
    "location": "playlistId"
   }
  ],
  "code": 404,
  "message": "The playlist identified with the requests \u003ccode\u003eplaylistId\u003c/code\u003e parameter cannot be found."
 }
}

There also seems to be no other way to fetch the list entries from the API. A workaround would be fetching the Video IDs to play directly from the YouTube website. If we had working code for this, we still would need to figure out when to fetch new entries from YouTube and transmit them to Kodi.

maciex commented 7 years ago

Why not send the ID of the playlist/mix to the Youtube addon in Kodi? It should (is it supported?) handle those kind of requests. In such case there would be no processing needed on the Play-to-xbmc addon side.

Itja commented 7 years ago

From my readings yesterday, my guess is that the problem is that you can't communicate directly with the addons, only with Kodi via the JSON-RPC API. And that API surely has no idea of YouTube playlists (since they're addon-specific). I don't know if when the YouTube-addon would cooperate, maybe it would be possible giving Kodi a playlist URI to play, and the YouTube-addon itself would then expand the playlist URI on Kodi's playlist. (But then again, I'm very new to the Kodi RPC and YT addon, so maybe there is another less-hacky way.)

maciex commented 7 years ago

You can send JSON-RPC to play a video in Kodi's Youtube Plugin, ex.: curl --user USER:PASSWORD --header "Content-Type: application/json" --data '{"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"plugin://plugin.video.youtube/play/?playlist_id=RDEMHk07TM01OFpLd0Sok9_H2w&order=default&play=1"}}}' "http://192.168.0.XX:8080/jsonrpc"