sync icon indicating copy to clipboard operation
sync copied to clipboard

RFC: API

Open calzoneman opened this issue 4 years ago • 6 comments

Over the years I've gotten several questions about whether CyTube has a supported API, and in particular the frequency of this question seems to be increasing recently. I'm not committing to anything immediately, but I want to open this issue to start a conversation with the community on what use cases people have that they are trying to solve through an API.

I'll start by listing a few possibilities (these are not necessarily mutually exclusive) -- I am looking for your feedback on which kinds of API functionality would be most useful.

Websocket API

The only currently supported way to interact with CyTube is to emulate a socket.io client, as many bot authors have done. This could be improved by (1) documenting the protocol instead of requiring authors to read the client/server code to reverse engineer it, and (2) transitioning to a plain-websocket based API to remove the dependency on socket.io (which is not well-supported outside of the JavaScript ecosystem).

REST API

CyTube could offer a REST API for programmatic manipulation of channels/playlists without establishing a long-running websocket.

Webhooks

CyTube could send event notifications to registered webhooks to enable users to trigger on certain events (e.g. when a video starts playing).

calzoneman avatar Jul 04 '20 19:07 calzoneman

Thanks for initiating the discussion around this. APIs will definitely expand and grow cytube/sync into many creative integrations. I'm especially interested in rest API. Rest api's are kind of bare minimum these days for most apps. In my use case I would like to use it to showcase the channels and playlist info on sites/pages where there will be marketing content to promote different channels. You can call them landing pages, where users/visitors will get a sneak preview of how you can watch varied content together with friends. This is important for me because that will mean we can have marketing and promotional site as a separate entity e.g (wordpress/ghost) without worrying about messing up the sync engine.

Websockets based API's are cool too, however as you pointed out they are a bit too tied to JS ecosystem. However they can let us do some realtime stuff like this cool demo of how people are using venmo. https://venmo.com/

image

fais3000 avatar Jul 04 '20 20:07 fais3000

I'd definitely want to transition to µWebSockets.js if possible. I know the reddit crowd likes to harp on the guy and not trust him, and I certainly don't blame them, but that fork has been consistently supported since May 6, 2018, it's last commit was just 17 days ago, and it's continued development is financed by 4 large BTC exchanges. It had direct support for Node, Python, C++ and anything that can wrap it.

Xaekai avatar Jul 19 '20 11:07 Xaekai

Hello. I have been using this site for many years and was an original user at synchtube. Recently I started developing APIs, and I would be happy to contribute to a Websocket API.

ajtran303 avatar Nov 08 '20 03:11 ajtran303

A simple REST API for manipulating playlists alone would be perfect and prevent the need for modifying bots to use for mundane tasks

juniperrrrr avatar Dec 29 '20 00:12 juniperrrrr

A simple REST API for manipulating playlists alone would be perfect and prevent the need for modifying bots to use for mundane tasks

I'd be down for this. Like adding videos to the beginning or end of a playlist?

Crud (Create / read / update / delete) functionality could be pretty useful.

ajtran303 avatar Feb 06 '21 17:02 ajtran303

What about a JSON RPC api? It would be pretty simple for other languages to implement over websocket

caspiano avatar Jul 03 '21 12:07 caspiano