Categories: ComputingDevelopment

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.

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.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago