From f4db2dfeab3abaf50943765005e3a3218bad0f90 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Fri, 3 Dec 2021 15:49:12 +0530 Subject: [PATCH] Shift from youtube-dl to yt-dlp Signed-off-by: Joseph Nuthalapati --- README.md | 6 +++--- src/lib.nim | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 13cb14a..fa32d61 100644 --- a/README.md +++ b/README.md @@ -71,15 +71,15 @@ I made this just for myself. The development is completely based on my needs and ## Installation Nim Coon depends on the following: -- youtube-dl +- yt-dlp - mpv (recommended) or vlc - peerflix and webtorrent (for magnet links) Install MPV or VLC using your distribution's package manager. -Install YouTube-dl +Install yt-dlp ``` sh -pip3 install --user youtube-dl +pip3 install --user yt-dlp ``` Install PeerFlix and WebTorrent diff --git a/src/lib.nim b/src/lib.nim index 4dbbf8b..3dcf78a 100644 --- a/src/lib.nim +++ b/src/lib.nim @@ -119,24 +119,24 @@ func buildDownloadArgs(url: string, options: Options): seq[string] = proc download*(args: openArray[string], title: string) = printTitle("Downloading", title) - discard execShellCmd(&"youtube-dl {args.join(\" \")}") + discard execShellCmd(&"yt-dlp {args.join(\" \")}") proc directDownload*(url: string, options: Options) = let args = buildDownloadArgs(url, options) if "aria2c".isInstalled: - discard execShellCmd(&"youtube-dl {args.join(\" \")} --external-downloader aria2c --external-downloader-args '-x 16 -s 16 -k 2M'") + discard execShellCmd(&"yt-dlp {args.join(\" \")} --external-downloader aria2c --external-downloader-args '-x 16 -s 16 -k 2M'") else: - discard execShellCmd(&"youtube-dl {args.join(\" \")}") + discard execShellCmd(&"yt-dlp {args.join(\" \")}") proc luckyDownload*(searchQuery: string, options: Options) = - let args = @[&"ytsearch:\"{searchQuery}\""] & buildDownloadArgs("", options) - let title = execProcess(&"youtube-dl --get-title {args.join(\" \")}").split("\n")[0] + let args = @[&"ytsearch1:\"{searchQuery}\""] & buildDownloadArgs("", options) + let title = execProcess(&"yt-dlp --get-title {args.join(\" \")}").split("\n")[0] download(args, title) proc luckyPlay*(searchQuery: string, player: string, options: Options) = let args = @[&"ytsearch:\"{searchQuery}\""] & buildDownloadArgs("", options) - let output = execProcess(&"youtube-dl --get-url --get-title {args.join(\" \")}").split("\n") + let output = execProcess(&"yt-dlp --get-url --get-title {args.join(\" \")}").split("\n") let title = output[0] url = &"\"{output[1]}\"" -- 2.43.0