YouTube Extractor
This powerful little app extracts just about everything from a YouTube video.
- Open a new folder in VisualStudio and create a new file called: extract_youtube_video.py
- Copy and paste this code and save.
import yt_dlp
import json
from pathlib import Path
def main():
print("šļø Output.GURU YouTube Audio + Metadata Extractor\n")
# Ask for URL
url = input("Enter YouTube URL: ").strip()
if not url:
print("ā No URL entered. Exiting.")
return
# Extract metadata only (no download yet)
with yt_dlp.YoutubeDL({"skip_download": True}) as ydl:
info = ydl.extract_info(url, download=False)
title = info.get("title", "outputguru_audio")
license_type = info.get("license", "Unknown")
print(f"\nš Video: {title}")
print(f"š License: {license_type}")
# License check
if "Creative Commons" not in license_type:
print("ā ļø WARNING: This video is NOT under a Creative Commons license!")
choice = input("Do you still want to proceed with download? (y/N): ").strip().lower()
if choice != "y":
print("š« Download cancelled.")
return
else:
print("ā
Creative Commons license detected. Safe to proceed.")
# Ask for format
fmt = input("Preferred audio format (default=mp3): ").strip().lower() or "mp3"
# Ask for quality
quality = input("Preferred quality (default=192): ").strip() or "192"
print("\nā³ Downloading... please wait\n")
ydl_opts = {
"format": "bestaudio/best",
"outtmpl": "%(title)s.%(ext)s",
"postprocessors": [
{
"key": "FFmpegExtractAudio",
"preferredcodec": fmt,
"preferredquality": quality,
}
],
"writeinfojson": True, # save metadata JSON
"writethumbnail": True, # save thumbnail image
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(url, download=True)
# File paths
audio_file = Path(f"{title}.{fmt}")
json_file = Path(f"{title}.info.json")
thumb_file = Path(f"{title}.jpg")
# Show results
if audio_file.exists():
print(f"ā
Audio saved: {audio_file.name}")
if json_file.exists():
print(f"ā
Metadata saved: {json_file.name}")
if thumb_file.exists():
print(f"ā
Thumbnail saved: {thumb_file.name}")
print("\nš Done! Files are saved in the current folder.")
if __name__ == "__main__":
main()
3. Required Dependencies
Open terminal inside your root folder and install these dependencies.
pip install yt-dlp
4. Install FFmpeg (Windows)
- Download from: https://www.gyan.dev/ffmpeg/builds/ (get the release full .zip).
- Extract it, e.g. to:
C:\ffmpeg\
- Add
C:\ffmpeg\bin
to your PATH:- Windows Search ā “Environment Variables”
- Edit
Path
ā Add new entry:C:\ffmpeg\bin
- Verify:
ffmpeg -version
ā should print version info.
5. Open a terminal window inside your folder and type in python extract_yoube_video.py
Example output: When ran in Terminal in Visual Studio

The audio file, thumbnail image and JSON metadata are saved in the root folder.