marcopeocchi / yt-dlp-web-ui

A terrible web ui for yt-dlp. Designed to be self-hosted.
Mozilla Public License 2.0
659 stars 68 forks source link

Download REST API endpoints #72

Closed marcopeocchi closed 11 months ago

marcopeocchi commented 11 months ago

Update: downloads REST API

Hello ✋,

This PR brings a new functionality asked in #70. Since the main focus is using the provided JSON-RPC interface the REST one will only bring limited funtionalities.

Group: /api/v1

Method Route Description
POST /exec Asynchronously starts a download
GET /running Gets running downloads

Examples

Start a download using /exec:

POST http://localhost:3033/api/v1/exec

Body

{
  "url": "https://...",
  "params": ["-N", "4", "-R", "infinite"] 
}

Returns The id of the download.

Refactor

The backend side has been entirely refactor starting from the last PR: fiber has been dropped for the standard library http package.

The reason behind this is because fiber was used soley for it's nice WebSockets API. Since I found gorilla's websockets which seamlessly integrates with the http package it was a no brainer. Moreover I don't like the philosophy behind fasthttp package. 🤠

Frontend side sees an improved rendering performance by cutting some unecessary useStates.
Anyhow is planned to migrate from redux to recoil or another atom base state manager to squeeze more performance.

Hopefully closes #70. 😎