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.

Revisions

  1. nicebyte created this gist Apr 14, 2021.
    26 changes: 26 additions & 0 deletions udl.ahk
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    ; 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"
    }