Copy the text containing chapter information directly from YouTube and convert it into simple mkvmerge chapter format to embed in your downloaded YouTube video.
mkvmerge
command line tool or MKVToolNix GUI
installeddeno install -Af https://deno.land/x/simple_youtube_chapter_extractor@v1.0.0/youtube-chapter-extractor.ts
https://github.com/denoland/deno/issues/3139
rm $(which youtube-chapter-extractor)
⭐️ Course Contents ⭐️
Introduction
---------------------
⌨️ (00:00:00) Introduction
⌨️ (00:02:02) Course overview
⌨️ (00:04:38) Course Project
⌨️ (00:05:51) What is Deno
⌨️ (00:08:19) Course project (Survey app) demo
⌨️ (00:11:54) Install and Getting started
⌨️ (00:14:34) Write "Hello World"
⌨️ (00:15:50) Main Features
YouTubers can create the list of chapters in any way they like, the following are some common ones supported:
The time stamp in either 00:00
or 00:00:00
format followed by either:
space
title
:
03:00:00 Introduction
)
space
title
:
⌨️ (00:00:00) Introduction
space
-
space
title
02:00 - Introduction
The current regex used is:
/(?<time>\d{2}:\d{2}:\d{2}|\d{2}:\d{2})\)?\s(\-)?(\s)?(?<chapterTitle>.*)/g;
.
To see what it does paste it into regex101.com. Please contribute more formats to help others use this program!
youtube-chapter-extractor [name of text file to process]
or if you did not install it and running from source file:
./youtube-chapter-extractor.ts [name of text file to process]
MKVToolNix GUI
which contains all the functionality of mkvmerge
or
mkvmerge
from the home site and use:mkvmerge \
--chapters originalfilename_chapters.txt \
-o output-file.mkv \
input-file.mkv
or
flatpak run --command=mkvmerge org.bunkus.mkvtoolnix-gui --chapters originalfilename_chapters.txt -o output-file.mkv input-file.mkv
deno test
to run tests.
deno --unstable lint youtube-chapter-extractor.ts
to lint.
mkvmerge
usageyoutube-dl
chapter extraction from JSON file. The feature is currently broken in 2020.11.17
, youtube-dl --write-info-json
results in "chapters": null
The future of video sharing is federated peer to peer, we must be free to express ourselves without corporate or government censorship. Have a look at https://joinpeertube.org/.
Author: David-Else
Source Code: https://github.com/David-Else/simple-youtube-chapter-extractor
#deno #nodejs #node #javascript