Download a YouTube video comments with yt-dlp

Another seemingly hidden feature with yt-dlp is the ability to save the YouTube video comments into a JSON file.

yt dlp install and usage guide

With yt-dlp downloading the video comments into a JSON file is done with the --write-comments flag.

yt-dlp --write-comments VIDEO_URL

For popular videos with a lot of comments, this can take several minutes.

An example of a comment in the JSON file:

{
   "id": "UgzewWuFZvI0FsncvKR4AaABAg",
   "text": "These double ads are really getting on my nerves",
   "timestamp": 1614816000,
   "time_text": "1 year ago",
   "like_count": 1,
   "is_favorited": false,
   "author": "Michael M",
   "author_id": "UCKYW7m35n1kBassjpjakd7g",
   "author_thumbnail": "https://yt3.ggpht.com/ytc/AKedOLRr_ZwtCbdnb_qiqsKkwnTT4Y0eSW9SpgklicNt=s176-c-k-c0x00ffffff-no-rj",
   "author_is_uploader": false,
   "parent": "root"
 }

This flag is a part of the --write-info-json section where video metadata gets saved to the JSON file too. If you only want the video comments add --no-write-info-json.