]> njoseph.me Git - nimcoon.git/commitdiff
Shift from youtube-dl to yt-dlp
authorJoseph Nuthalapati <njoseph@riseup.net>
Fri, 3 Dec 2021 10:19:12 +0000 (15:49 +0530)
committerJoseph Nuthalapati <njoseph@riseup.net>
Fri, 3 Dec 2021 10:19:12 +0000 (15:49 +0530)
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
README.md
src/lib.nim

index 13cb14a29b0f8d9c87f03fdbb8ec6cf6f53ea276..fa32d611d3805c6a1610d80ad82d01313bb9735c 100644 (file)
--- 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
index 4dbbf8be6f74ea687d8b728fcbbd5d460a9fafaa..3dcf78a3914b9d83196121ad09c273bb87253971 100644 (file)
@@ -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]}\""