3 This is a personal wrapper around [
yt-dlp ](
https://github.com/yt-dlp/yt-dlp ) that downloads a video with thumbnails and subtitles, converts to my preferred formats, then prints some key information in a consistent JSON format.
6 $ yt-dlp_alexwlchan.py
"https://www.youtube.com/watch?v=TUQaGhPdlxs"
9 "url": "https://www.youtube.com/watch?v=TUQaGhPdlxs",
10 "title": "\"new york city, manhattan, people\" - Free Public Domain Video",
11 "description": "All videos uploaded to this channel are in the Public Domain: Free for use by anyone for any purpose without restriction. #PublicDomain",
12 "date_uploaded": "2022-03-25T01:10:38Z",
13 "video_path": "\uff02new york city, manhattan, people\uff02 - Free Public Domain Video [TUQaGhPdlxs].mp4",
14 "thumbnail_path": "\uff02new york city, manhattan, people\uff02 - Free Public Domain Video [TUQaGhPdlxs].jpg",
15 "subtitle_path": null,
17 "id": "UCDeqps8f3hoHm6DHJoseDlg",
18 "name": "Public Domain Archive",
19 "url": "https://www.youtube.com/channel/UCDeqps8f3hoHm6DHJoseDlg",
20 "avatar_path": "publicdomainarchive3052.png"
26 I have other scripts that know how to read this format, and it allows me to consolidate all my video-downloading logic in one place.
27 Other scripts can call this script and get the title or description "for free".
31 * Downloads the video, thumbnail, and subtitles to a temporary directory
32 * Convert the video to MP4 and the thumbnail to JPEG (my preferred formats)
33 * Gets some info about the video (title, description) and channel (name, URL, avatar URL)
34 * Prints all that info in a convenient JSON object
38 Clone the repo, create a virtualenv, and install dependencies:
41 $ git clone https://github.com/alexwlchan/yt-dlp_alexwlchan.git
43 $ python3 -m venv .venv
44 $ pip install -r requirements.txt
47 Then save the following script somewhere in your PATH (replacing the
`cd` with the root to your checkout):
55 cd ~/repos/yt-dlp_alexwlchan
56 source .venv/bin/activate
57 python3 yt-dlp_alexwlchan.py
" $@ "
62 yt-dlp supports a wide range of site, but I only map YouTube and Instagram with this tool.
64 ## Can other people use this?
66 You're welcome to, but I wouldn't recommend it.
67 Partly because I don't guarantee long-term stability or support, partly because you'll have different preferences to me.
69 Instead, use this script as a starting point to write your own variant.
71 ## Why did you pick this name?
73 yt-dlp uses this name for its [
release variants ](
https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#release-files ) (e.g.
`yt-dlp_linux` ,
`yt-dlp_win` ,
`yt-dlp_macos` ).
76 I'm not a yt-dlp contributor; this isn't endorsed by or affiliated with yt-dlp.
77 It's just my wrapper around their project.