Skip to content

Instantly share code, notes, and snippets.

@nicebyte
Created April 14, 2021 03:36
Show Gist options
  • Save nicebyte/c87b6623e1932bf6a18406d4dfb09caa to your computer and use it in GitHub Desktop.
Save nicebyte/c87b6623e1932bf6a18406d4dfb09caa to your computer and use it in GitHub Desktop.
Authohotkey script to download audio from the youtube video in the current tab.
; Extracts audio from the youtube video in the current tab.
; Requires youtube-dl and ffmpeg.
; Download location.
DownloadDir := "d:\\music\\dump"
; Hotkey that triggers the script (Win+Z).
#Z::
ClipSaved:=ClipboardAll
Clipboard=
Sleep 100
Send ^l^c
ClipWait 0.1
url:=Clipboard
Clipboard:=ClipSaved
ClipSaved=
is_yt := RegexMatch(url, "youtube\.com\/watch")
if (is_yt > 0) {
prefix := "youtube-dl --extract-audio --embed-thumbnail --audio-quality 0 --audio-format mp3"
RunWait %ComSpec% /c %prefix% %url%, %DownloadDir%
} else {
MsgBox, 16, "youtube-dl", "That is not a youtube video"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment