youtube-playlist-duration-calculator

YouTube Playlist Duration Calculator

A web extension for Chrome & Firefox that calculates & displays the total duration of a YouTube playlist.

Previews

Get the extension

The extension is available for download at:

Features

[!NOTE]
The sorting feature is only enabled for playlists containing 100 videos or less. This is because for larger playlists (>100 videos), YouTube only loads the next 100 videos after you scroll to the bottom of the page. This can often produce inconsistent & inaccurate sorting results, so it has been disabled for now.

What happens when the extension cannot locate the playlist

If YouTube changes its DOM structure in a way that none of the extension’s strategies can recognize, the extension displays a red-bordered diagnostic indicator inside the playlist summary panel. This indicator includes:

To help diagnose issues before they appear as failures, open the playlist page with ?ytpdc-debug=true appended to the URL. The extension will log detailed strategy information to the browser console.

Architecture

The extension uses a layered strategy system to survive YouTube DOM changes:

  1. Desynchronization Detection: Identifies which rendering architecture YouTube is using (“renderer”, “viewmodel”, or “unknown”)
  2. Discovery Strategies: Find the playlist container using either known CSS selectors or structural invariants (looking for video-card-like elements by their structure, not their tag names)
  3. Extraction Strategies: Extract timestamps using either known element selectors or content pattern matching (scanning text for MM:SS / HH:MM:SS patterns)
  4. Confidence Aggregation: Tracks which extraction strategy succeeded for each video and reports an estimated error margin when pattern matching was used

Strategies are prioritized by the detected variant: the strategy most likely to succeed runs first. If it finds everything needed, no further strategies are executed.

Getting Started

This section will explain how to get the project setup locally for development.

Dependencies

To work with this project, you will need the following dependencies:

Get the Source

This project is hosted at: https://github.com/nrednav/youtube-playlist-duration-calculator

You can clone the project locally via:

HTTPS:

git clone https://github.com/nrednav/youtube-playlist-duration-calculator.git

SSH:

git clone git@github.com:nrednav/youtube-playlist-duration-calculator.git

Installation

To install the project’s dependencies:

cd youtube-playlist-duration-calculator/
npm install

Building

Build the extension for a specific browser using:

npm run build:chrome
npm run build:firefox

This will output the extension files into a sub-directory named dist within the youtube-playlist-duration-calculator directory.

Run

Automatic

Run the project in development mode with:

npm run dev

This will do the following:

Manual

To install & run the extension manually, follow these steps:

Firefox:

Chrome:

To verify the extension works, visit any YouTube playlist overview page & verify that you see the duration calculated & displayed within the playlist information panel located on the left-hand side of the page.

Issues & Requests

If you wish to request a new feature or report a bug, please open an issue by clicking here. Note that the “Report this issue” link in the extension’s failure banner points to a no-account Google Form instead, for users who do not have a GitHub account.

Translations

For a list of locales currently supported by the extension, please see public/_locales

Additional translations are most welcome! Please see docs/translations.md for more details.

Support

If you found this extension helpful and would like to help support its development:

ko-fi