YT Playlist Analyser is a Bash-based command line utility for analyzing YouTube playlists. It retrieves video metadata using yt-dlp, calculates the total playlist duration, and provides estimated watch times at different playback speeds.
The script is designed to be lightweight, memory efficient, and suitable for large playlists by streaming data directly from yt-dlp without storing the full dataset in memory.
- Validates required system dependencies before execution
- Streams playlist metadata without loading the entire list into memory
- Displays per video:
- Sequential index number
- Formatted duration in HH:MM:SS
- Video title
- Calculates total playlist duration
- Provides estimated completion times at:
- 1.00x
- 1.25x
- 1.50x
- 2.00x
- Interactive CLI loop for multiple playlist analyses
This script requires the following tools to be installed on your system:
- yt-dlp
- bc
- Bash shell
sudo apt update
sudo apt install yt-dlp bcsudo dnf install yt-dlp bcIf yt-dlp is not available in your enabled repositories:
sudo dnf install python3-pip
pip install -U yt-dlpsudo pacman -S yt-dlp bcsudo zypper install yt-dlp bcsudo apk add yt-dlp bc- Install Termux from F-Droid.
- Update packages:
pkg update
pkg upgrade- Install dependencies:
pkg install yt-dlp bcIf yt-dlp is unavailable:
pkg install python
pip install -U yt-dlpYou can then clone and run the script normally inside Termux.
- Clone this repository:
git clone https://github.com/harshit2k4/YT-Playlist-Analyser.git
cd YT-Playlist-Analyser- Make the script executable:
chmod +x analyser.sh- Run the script:
./analyser.shWhen executed, the program starts an interactive prompt:
YT Playlist Analyser
Enter a YouTube playlist URL to begin.
Enter 'q' to quit the program.
Enter a valid YouTube playlist URL. The tool will:
- Retrieve playlist entries using yt-dlp
- Display each video's duration and title
- Calculate the total number of videos
- Display total playlist duration
- Show estimated watch times at different playback speeds
To exit the program, enter:
q
or
quit
NUM | DURATION | TITLE
--------------------------------------------------
[001] | 00:10:35 | Introduction to Topic
[002] | 00:08:42 | Deep Dive into Concept
...
SUMMARY
Total Videos : 25
Total Duration: 05:42:18
ESTIMATED WATCH TIME AT DIFFERENT SPEEDS
Standard (1.00x): 05:42:18
Fast (1.25x): 04:33:44
Faster (1.50x): 03:48:12
Double (2.00x): 02:51:09
The script verifies that:
- yt-dlp is installed
- bc is installed for floating point calculations
If a dependency is missing, the program exits with an error message.
Durations are converted from seconds to a human readable HH:MM:SS format.
Playlist data is processed line by line using process substitution:
while IFS='|' read -r duration titleThis approach avoids storing the full playlist in memory and ensures efficient handling of large playlists.
- Only publicly accessible playlists are supported
- Internet connectivity is required
- The tool relies on yt-dlp output format
- Private or restricted videos may report zero duration