srt-to-youtube-chapters
v1.0.0
Published
SRT to YouTube Chapters — Turn an .srt subtitle file into a YouTube chapter list — first chapter forced to 0:00, which YouTube silently requires, plus a check against its three-chapter and ten-second rules.
Maintainers
Readme
srt-to-youtube-chapters
SRT to YouTube Chapters — Turn an .srt subtitle file into a YouTube chapter list — first chapter forced to 0:00, which YouTube silently requires, plus a check against its three-chapter and ten-second rules.
Zero dependencies. Pure functions, no I/O, no DOM. Runs in Node and in the browser unchanged.
Try it without installing anything: https://owaiskhan.website/tools/srt-to-youtube-chapters/
Install
npm install srt-to-youtube-chaptersUse
import { srtToYoutubeChapters } from 'srt-to-youtube-chapters';
const result = srtToYoutubeChapters(input);
console.log(result);API
const MIN_CHAPTERS
See the source for details.
const MIN_CHAPTER_SECONDS
See the source for details.
function parseTimestamp(stamp)
See the source for details.
function formatTimestamp(totalSeconds)
See the source for details.
function cleanText(text)
See the source for details.
function parseSrt(srt)
See the source for details.
function toTitle(text, maxLength)
See the source for details.
function buildChapters(cues, options)
Turn cues into a YouTube chapter list. Cues closer together than minGap are merged, because subtitle cues are a
function validate(chapters)
See the source for details.
function srtToYoutubeChapters(srt, options)
SRT text -> the block you paste into a YouTube description, plus the parsed chapters and any rule the result breaks.
Why this exists
The hosted version at https://owaiskhan.website/tools/srt-to-youtube-chapters/ runs this exact module in the browser — the page and the package cannot disagree, because there is one implementation. Nothing you paste into the hosted tool leaves your browser.
Keywords
srt to youtube chapters · youtube chapter generator · srt to chapters converter · subtitle to youtube chapters
License
MIT © Owais Khan
