Skip to content

how do i deal with SRT files containing HTML? #163

@keredson

Description

@keredson

example:

1
00:00:00,970 --> 00:00:03,000
<font face="Serif" size="18">Jellyfish at the Monterey Aquarium</font>

2
00:00:04,080 --> 00:00:06,080
<font face="Serif" size="18">Dude - get out of the way!</font>

3
00:00:09,350 --> 00:00:13,350
<font face="Serif" size="18">Shaky Hands...</font>

4
00:00:17,000 --> 00:00:22,000
<font face="Serif" size="18">Ah yes, this is better...</font>

5
00:00:24,825 --> 00:00:27,825
<font face="Serif" size="18">Pro Tip: Turn off the camera flash!</font>

6
00:00:33,000 --> 00:00:45,446
<font face="Serif" size="18">Thanks for watching and I hope you'll have fun with the VideoSub library!</font>

if i convert it to webvtt i get this:

WEBVTT

00:00.970 --> 00:03.000
&lt;font face="Serif" size="18">Jellyfish at the Monterey Aquarium&lt;/font>

00:04.080 --> 00:06.080
&lt;font face="Serif" size="18">Dude - get out of the way!&lt;/font>

00:09.350 --> 00:13.350
&lt;font face="Serif" size="18">Shaky Hands...&lt;/font>

00:17.000 --> 00:22.000
&lt;font face="Serif" size="18">Ah yes, this is better...&lt;/font>

00:24.825 --> 00:27.825
&lt;font face="Serif" size="18">Pro Tip: Turn off the camera flash!&lt;/font>

00:33.000 --> 00:45.446
&lt;font face="Serif" size="18">Thanks for watching and I hope you'll have fun with the VideoSub library!&lt;/font>

i'm converting like this:

      converter = pycaption.CaptionConverter()
      converter.read(srt, pycaption.detect_format(srt)())
      subtitles = converter.write(pycaption.WebVTTWriter())

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions