Downloading Audio from YouTube Videos w/ YT-DLP fork of youtube-dl

This is in no way tutorial, but I want you to know that I’m using yt-dlp to download stuff from YouTube directly.

I use my script (below) to download the audio that goes with the video Madeleine Dring โ€“ Trio for Flute, Oboe and Piano (1968)(with full score:

youtube-dl-audio https://youtu.be/Q4wzM9kcqNg

My script is youtube-dl-audio is this (it calls yt-dlp to do the work):

#!/bin/bash
yt-dlp --verbose -x --audio-format mp3 $1

yt-dlp will download the actual video file, then use ffmpeg to split off the audio portion for you.

To download the video file itself:

yt-dlp https://youtu.be/Q4wzM9kcqNg

2 thoughts on “Downloading Audio from YouTube Videos w/ YT-DLP fork of youtube-dl”

  1. Hi thera I need ypur help I use yt-dlp modul to download music from youtube but in my code no asynchronous code that why can you help me to work code asynchronously
    options = {
    # ‘proxy’: ‘test’,
    ‘cookies’: ‘cookies.txt’,
    ‘extract_audio’: True,
    ‘format’: ‘bestaudio/best’,
    ‘outtmpl’: f'{title}.mp3′}
    with YoutubeDL(options) as yt:
    yt.extract_info(id, download=True)

    1. Hello. I did some searching and found this about async for Javascript:

      Master Async/Await in JavaScript: A Practical Guide for Asynchronous Programming

      Async/await is a syntax for dealing with asynchronous code in JavaScript. It allows you to write asynchronous code that looks and behaves like synchronous code, using the async and await keywords.

      async function getData() {
      const response = await fetch('https://api.example.com/data');
      const data = await response.json();
      return data;
      }

      And I found this for Python:

      Run an async function when youtube-dl finishes downloading (python)

      The easiest way to schedule asynchronous execution of a coroutine from blocking code is loop.create_task. Since callback inherits the scope of the enclosing play method, we can use self.bot.loop directly:


      def callback(d):
      if d['status'] == 'finished':
      self.bot.loop.create_task(ctx.send("Done!"))
      print("Done!")

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top