marcopeocchi / yt-dlp-web-ui

A terrible web ui and RPC server for yt-dlp. Designed to be self-hosted.
GNU General Public License v3.0
820 stars 85 forks source link

Download Path and more metadata #48

Open schmoaaaaah opened 1 year ago

schmoaaaaah commented 1 year ago

Hi.

I was wondering if there is some sort of documentation about the rpc api. I found a little information from your other rpc project and the rpcclient.js, but maybe there is something a little more userfriendly and more complete? Also would it be possible to add the path of the downloaded media to the rpc response or possibly even the whole yt-dlp metadata?

marcopeocchi commented 1 year ago

Hi @Schmoaaaaah,

You're right the project lacks documentation.
I'm writing a wiki page with for the JSON-RPC side. By tomorrow evening I'm expecting to complete it.

Adding the path of the downloaded file to the response is useful. Regarding the whole yt-dlp payload i'm concerned with the size of the object that will need to be encoded.

schmoaaaaah commented 1 year ago

Hi.

That looks really good thank you. I agree with the bulkyness of the whole yt-dlp payload. Maybe a extra function that just returns metadata of a video without downloading? I added there example of how to do it. You probaply call the executable with parameters as you use go? To do it with parameters would probaply be -j --no-download

import json
import yt_dlp

URL = 'https://www.youtube.com/watch?v=BaW_jenozKc'

# ℹ️ See help(yt_dlp.YoutubeDL) for a list of available options and public functions
ydl_opts = {}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    info = ydl.extract_info(URL, download=False)

    # ℹ️ ydl.sanitize_info makes the info json-serializable
    print(json.dumps(ydl.sanitize_info(info)))