GoSaveTool for Elixir
Parse, convert, shift and repair SRT and WebVTT subtitles, and count words, characters and reading time with social media character limits, Title Case, slugs and other case changes. No dependencies.
Made by GoSaveTool, free online tools for creators.
Install
def deps do
[{:gosavetool, "~> 1.0"}]
end
Subtitles
alias GoSaveTool.Subtitles
vtt = Subtitles.convert(File.read!("movie.srt"), :vtt)
cues = Subtitles.parse(text) # [%Cue{start: 1000, stop: 3500, settings: "", text: "Hello"}, ...]
later = cues |> Subtitles.shift(1500) |> Subtitles.to_srt()
{fixed, n} = Subtitles.repair(cues) # sorted, no overlaps, no empty cues
Text
alias GoSaveTool.Text
Text.stats(post) # %{words: 42, chars: 230, chars_no_spaces: 190, lines: 3, sentences: 4, read_seconds: 11}
Text.check_limits(post)["x-post"].fits # also instagram-caption, tiktok-caption, youtube-title, seo-title, ...
Text.title("the lord of the rings") # "The Lord of the Rings"
Text.slug("Ölçü Birimi & Çeviri!") # "olcu-birimi-ceviri"
Text.camel("best posting time") # "bestPostingTime"
Characters are Unicode code points, so an emoji counts as one, as on social media. The rules are the same as the @gosavetool/subtitles and @gosavetool/text JavaScript packages.
Tests
mix test
Online tools
VTT Subtitle Generator, Auto Captions Generator, Character Counter
License
MIT