diff options
| author | Fuwn <[email protected]> | 2023-10-02 00:53:38 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-10-02 00:53:38 -0700 |
| commit | 90eb4437afa7f4f952de1ea893716c1afb8c4be6 (patch) | |
| tree | 3feb509ed4bdb04428221ea9449a70512fa60d33 | |
| parent | feat(kaguya): cookie file support (diff) | |
| download | kaguya-90eb4437afa7f4f952de1ea893716c1afb8c4be6.tar.xz kaguya-90eb4437afa7f4f952de1ea893716c1afb8c4be6.zip | |
fix(stream): add flags to download
| -rw-r--r-- | src/stream_command.sh | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/stream_command.sh b/src/stream_command.sh index 4c9e0c2..615822f 100644 --- a/src/stream_command.sh +++ b/src/stream_command.sh @@ -3,19 +3,32 @@ user_agent="Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0 if [[ -n "${args['--download']}" ]]; then START=$(date +%s) - yt-dlp \ - --all-subs \ - --cookies-from-browser firefox \ - --embed-subs \ - --external-downloader=aria2c \ - --external-downloader-args \ - '--min-split-size=1M --max-connection-per-server=16 --max-concurrent-downloads=16 --split=16' \ - -f 'best[height=1080]' \ - --remux mkv \ - --merge mkv \ - --verbose \ - --user-agent "${user_agent}" \ + yt_dlp_command=( + "yt-dlp" + "--all-subs" + "--cookies-from-browser" "firefox" + "--embed-subs" + "--external-downloader=aria2c" + "--external-downloader-args" + '--min-split-size=1M --max-connection-per-server=16 --max-concurrent-downloads=16 --split=16' + "-f" 'best[height=1080]' + "--remux" "mkv" + "--merge" "mkv" + "--verbose" + "--user-agent" "${user_agent}" "${args[uri]}" + ) + + if [ -n "${args['--username']}" ] || [ -n "${args['--password']}" ]; then + yt_dlp_command+=(-u "${args['--username']}") + yt_dlp_command+=(-p "${args['--password']}") + fi + + if [ -n "${args['--cookies']}" ]; then + yt_dlp_command+=(--cookies "${args['--cookies']}") + fi + + "${yt_dlp_command[@]}" printf "\ntook %s seconds\n" $(($(date +%s || true) - START)) |