+3 votes
in Programming Languages by (39.3k points)
I want to find the duration of a Youtube video without opening the video in a browser. Is there any module or command to get the duration?

1 Answer

0 votes
by (271k points)

There is a library youtube-dl which is a command-line program to download videos from YouTube and other video sites. You can install it and use it to get the details about the youtube video.

If you are using Ubuntu, install the library using the following command:

$ sudo apt install youtube-dl

Now run youtube-dl command to get the duration.

$ youtube-dl --get-duration https://www.youtube.com/watch?v=xu9QRLERepI

The above command with show "12:28"