1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

dr: support for segmented vtt subs

This commit is contained in:
Johan Andersson 2021-10-20 15:01:07 +02:00
parent d8f5e5157b
commit e79bb2b3d3
2 changed files with 4 additions and 1 deletions

View File

@ -172,7 +172,7 @@ def _hlsparse(config, text, url, output, **kwargs):
for sub in list(subtitles.keys()): for sub in list(subtitles.keys()):
for n in subtitles[sub]: for n in subtitles[sub]:
m3u8s = M3U8(http.request("get", get_full_url(n[0], url), cookies=cookies).text) m3u8s = M3U8(http.request("get", get_full_url(n[0], url), cookies=cookies).text)
if "cmore" in url or "viaplay" in url: if "cmore" in url or "viaplay" in url or "dr" in url:
subtype = "wrstsegment" subtype = "wrstsegment"
else: else:
subtype = "wrst" subtype = "wrst"

View File

@ -293,6 +293,8 @@ class subtitle:
cont.encoding = "utf-8" cont.encoding = "utf-8"
if "viaplay" in self.url: if "viaplay" in self.url:
cont.encoding = "utf-8" cont.encoding = "utf-8"
if "dr" in self.url:
cont.encoding = "utf-8"
text = cont.text.split("\n") text = cont.text.split("\n")
for t in text: # is in text[1] for tv4play, but this should be more future proof for t in text: # is in text[1] for tv4play, but this should be more future proof
if "X-TIMESTAMP-MAP=MPEGTS" in t: if "X-TIMESTAMP-MAP=MPEGTS" in t:
@ -341,6 +343,7 @@ class subtitle:
string += "{}\n{}\n\n".format(nr, "\n".join(sub)) string += "{}\n{}\n\n".format(nr, "\n".join(sub))
nr += 1 nr += 1
string = re.sub("\r", "", string)
return string return string
def stpp(self, subdata): def stpp(self, subdata):