calzoneman / sync

Node.JS Server and JavaScript/HTML Client for synchronizing online media
Other
1.46k stars 235 forks source link

RFC: API #878

Open calzoneman opened 4 years ago

calzoneman commented 4 years ago

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).

fais3000 commented 4 years ago

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

Xaekai commented 4 years ago

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.

ajtran303 commented 3 years ago

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.

juniperrrrr commented 3 years ago

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

ajtran303 commented 3 years ago

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.

caspiano commented 3 years ago

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