Repository: yt-dlp
Issue: Unable to download TV4 subtitles for Trap: Parse error
Labels: site-bug

### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.03.08.1**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Sweden

### Description

yt-dlp fails to download subtitles for Trap on TV4, throws a ParseError exception. Probably something to do with Swedish character ä, potentially not being encoded correctly.

I have tried the following URLs, all throw ParseError on the same text:

https://www.tv4play.se/program/trap/13740796
https://www.tv4play.se/program/trap/13740798
https://www.tv4play.se/program/trap/13740800
https://www.tv4play.se/program/trap/13740793
https://www.tv4play.se/program/trap/13740801
https://www.tv4play.se/program/trap/13740794
https://www.tv4play.se/program/trap/13740795

This URL for a different TV series almost works - fails on the penultimate fragment (no special Swedish character in the text reported but plenty in the previous fragments that were successfully collected):

https://www.tv4play.se/program/catch-and-release/13725754

[download]  99.8% of ~72.38KiB at  569.55B/s ETA 00:00 (frag 606/607)ERROR: Parse error at position 91 (near 'Text: Susie Kristens')

### Verbose log

```shell
yt-dlp -vU --write-subs sv --sub-format vtt "https://www.tv4play.se/program/trap/13740798"
[debug] Command-line config: ['-vU', '--write-subs', 'sv', '--sub-format', 'vtt', 'https://www.tv4play.se/program/trap/13740798']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, err UTF-8, pref UTF-8
[debug] yt-dlp version 2022.03.08.1 [c0c2c57d3] (zip)
[debug] Python version 3.7.3 (CPython 32bit) - Linux-5.10.63-v7l+-armv7l-with-debian-10.11
[debug] exe versions: ffmpeg 4.1.8-0, ffprobe 4.1.8-0, phantomjs ., rtmpdump 2.4
[debug] Optional libraries: Crypto, secretstorage, sqlite
[debug] Proxy map: {}
Latest version: 2022.03.08.1, Current version: 2022.03.08.1
yt-dlp is up to date (2022.03.08.1)
[debug] [generic] Extracting URL: sv
ERROR: [generic] 'sv' is not a valid URL. Set --default-search "ytsearch" (or run  yt-dlp "ytsearch:sv" ) to search YouTube
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 617, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/generic.py", line 2679, in _real_extract
    % (url, url), expected=True)

[debug] Using fake IP 78.75.126.29 (SE) as X-Forwarded-For
[debug] [TV4] Extracting URL: https://www.tv4play.se/program/trap/13740798
[TV4] 13740798: Downloading video info JSON
[TV4] 13740798: Downloading JSON metadata
[TV4] 13740798: Downloading m3u8 information
[TV4] 13740798: Downloading MPD manifest
[TV4] 13740798: Downloading f4m manifest
[TV4] 13740798: Downloading ISM manifest
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Downloading subtitles: sv
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 13740798: Downloading 1 format(s): hls-2910+mss-audio-128
[info] Writing video subtitles to: Trap del 2 [13740798].sv.vtt
[debug] Invoking downloader on "https://lbs-usp-hls-vod.cmore.se/vod/950eb/s0apbjtom15(13740798_ISMUSP).ism/s0apbjtom15(13740798_ISMUSP)-textstream_swe=3000.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1112
[download] Destination: Trap del 2 [13740798].sv.vtt
[download] Trap del 2 [13740798].sv.vtt.part-Frag13 has already been downloaded
[download]   1.2% of ~15.29KiB at  1.47KiB/s ETA Unknown (frag 13/1112)ERROR: Parse error at position 89 (near 'Det här är en fiktiv')
Traceback (most recent call last):
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1389, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1473, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1529, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2638, in process_video_result
    self.process_info(new_info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2890, in process_info
    sub_files = self._write_subtitles(info_dict, temp_filename)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3859, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2835, in dl
    return fd.download(name, new_info, subtitle)
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/common.py", line 453, in download
    ret = self.real_download(filename, info_dict)
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/hls.py", line 356, in real_download
    ctx, fragments, info_dict, pack_func=pack_fragment, finish_func=fin_fragments)
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/fragment.py", line 539, in download_and_append_fragments
    result = append_fragment(decrypt_fragment(fragment, frag_content), frag_index, ctx)
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/fragment.py", line 512, in append_fragment
    self._append_fragment(ctx, pack_func(frag_content, frag_index))
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/hls.py", line 270, in pack_fragment
    for block in webvtt.parse_fragment(frag_content):
  File "/usr/local/bin/yt-dlp/yt_dlp/webvtt.py", line 398, in parse_fragment
    raise ParseError(parser)
yt_dlp.webvtt.ParseError: Parse error at position 89 (near 'Det här är en fiktiv')
```