yt-dlp: include the video ID in the output
- ID
add6ee0- date
2025-10-05 20:03:33+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
86ecfd7- message
yt-dlp: include the video ID in the output Fixes #5- changed files
3 files, 7 additions
Changed files
README.md (2940) → README.md (2963)
diff --git a/README.md b/README.md
index f2b8544..85ab330 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@ This is a personal wrapper around [yt-dlp](https://github.com/yt-dlp/yt-dlp) tha
```console
$ yt-dlp_alexwlchan.py "https://www.youtube.com/watch?v=TUQaGhPdlxs"
{
+ "id": "TUQaGhPdlxs",
"url": "https://www.youtube.com/watch?v=TUQaGhPdlxs",
"title": "\"new york city, manhattan, people\" - Free Public Domain Video",
"description": "All videos uploaded to this channel are in the Public Domain: Free for use by anyone for any purpose without restriction. #PublicDomain",
tests/test_yt-dlp_alexwlchan.py (1283) → tests/test_yt-dlp_alexwlchan.py (1375)
diff --git a/tests/test_yt-dlp_alexwlchan.py b/tests/test_yt-dlp_alexwlchan.py
index ad74080..8a2985d 100644
--- a/tests/test_yt-dlp_alexwlchan.py
+++ b/tests/test_yt-dlp_alexwlchan.py
@@ -24,6 +24,8 @@ def test_youtube_video() -> None:
assert os.path.exists(video_info["thumbnail_path"])
assert video_info["subtitle_path"] is None
+ assert video_info["id"] == "TUQaGhPdlxs"
+
def test_instagram_video() -> None:
"""
@@ -41,3 +43,5 @@ def test_instagram_video() -> None:
video_info["channel"]["channel_url"]
== "https://www.instagram.com/publicdomaingems/"
)
+
+ assert video_info["id"] == "DMWY8KkOS0n"
yt-dlp_alexwlchan.py (4624) → yt-dlp_alexwlchan.py (4668)
diff --git a/yt-dlp_alexwlchan.py b/yt-dlp_alexwlchan.py
index 011e4f9..97b4406 100755
--- a/yt-dlp_alexwlchan.py
+++ b/yt-dlp_alexwlchan.py
@@ -83,6 +83,7 @@ class ChannelInfo(TypedDict):
class VideoInfo(TypedDict):
+ id: str
url: str
title: str
description: str
@@ -131,6 +132,7 @@ def download_video(url: str) -> VideoInfo:
sys.exit(f"Unsupported extractor: {video_info['extractor']}")
return {
+ "id": video_info["id"],
"url": url,
"title": video_info["title"],
"description": video_info["description"],