small refactor*

This commit is contained in:
royalcat 2025-03-22 08:49:14 +04:00
parent b6b541e050
commit 24a4d30275
232 changed files with 2164 additions and 1906 deletions
server/pkg/ytdlp

View file

@ -0,0 +1,27 @@
package ytdlp_test
import (
"context"
"fmt"
"io"
"testing"
"git.kmsign.ru/royalcat/tstor/server/pkg/ytdlp"
"github.com/royalcat/ctxprogress"
"github.com/stretchr/testify/require"
)
func TestDownload(t *testing.T) {
require := require.New(t)
ctx := context.Background()
c, err := ytdlp.New()
require.NoError(err)
ctx = ctxprogress.New(ctx)
ctxprogress.AddCallback(ctx, func(p ctxprogress.Progress) {
cur, total := p.Progress()
fmt.Printf("%d/%d\n", cur, total)
})
err = c.Download(ctx, "https://www.youtube.com/watch?v=dQw4w9WgXcQ", io.Discard)
require.NoError(err)
}