class_docstr: Load YouTube urls as audio file(s).
docstr: Yield audio blobs for each url.
code: def yield_blobs(self) -> Iterable[Blob]:
      """Yield audio blobs for each url."""
  
      try:
          import yt_dlp
      except ImportError:
          raise ImportError(
              "yt_dlp package not found, please install it with "
              "`pip install yt_dlp`"
          )
  
      # Use yt_dlp to download audio given a YouTube url
      ydl_opts = {
          "format": "m4a/bestaudio/best",
          "noplaylist": True,
          "outtmpl": self.save_dir + "/%(title)s.%(ext)s",
          "postprocessors": [
              {
                  "key": "FFmpegExtractAudio",
                  "preferredcodec": "m4a",
              }
          ],
      }
  
      for url in self.urls:
          # Download file
          with yt_dlp.YoutubeDL(ydl_opts) as ydl:
              ydl.download(url)
  
      # Yield the written blobs
      loader = FileSystemBlobLoader(self.save_dir, glob="*.m4a")
      self.files_out = [
          os.path.join(self.save_dir, f)
          for f in os.listdir(self.save_dir)
      ]
      for blob in loader.yield_blobs():
          yield blob
  
imports: import logging
  import os
  import tempfile
  import time
  from typing import Dict, Iterator, Optional, Tuple
  from langchain.document_loaders.base import BaseBlobParser
  from langchain.document_loaders.blob_loaders import Blob
  from langchain.document_loaders.generic import GenericLoader
  from langchain.schema import Document
  from typing import List, Union, Any, Tuple
  import requests
  from langchain.docstore.document import Document
  from langchain.document_loaders import ImageCaptionLoader
  from utils import get_device, NullContext, clear_torch_cache, have_use_faster, makedirs
  from importlib.metadata import distribution, PackageNotFoundError
  from typing import Iterable, List
  from langchain.document_loaders.blob_loaders import FileSystemBlobLoader
  from langchain.document_loaders.blob_loaders.schema import Blob, BlobLoader
label_desc: Use image node_id 2 for calling the YoutubeAudioLoader obj's underlying member method code with example usage: obj.yield_blobs() without return types