Move position where slash is appended

As base can be used as a format URL and the trailing slash could change the URL
This commit is contained in:
sepro 2024-02-20 00:23:08 +01:00
parent 09e8ee0d9e
commit 8c341f9a30

View file

@ -2334,7 +2334,7 @@ def _parse_smil_formats_and_subtitles(
for meta in smil.findall(self._xpath_ns('./head/meta', namespace)): for meta in smil.findall(self._xpath_ns('./head/meta', namespace)):
b = meta.get('base') or meta.get('httpBase') b = meta.get('base') or meta.get('httpBase')
if b: if b:
base = f'{b.rstrip("/")}/' base = b
break break
formats, subtitles = [], {} formats, subtitles = [], {}
@ -2383,7 +2383,7 @@ def _parse_smil_formats_and_subtitles(
}) })
continue continue
src_url = src if src.startswith('http') else urllib.parse.urljoin(base, src) src_url = src if src.startswith('http') else urllib.parse.urljoin(f'{b}/', src)
src_url = src_url.strip() src_url = src_url.strip()
if proto == 'm3u8' or src_ext == 'm3u8': if proto == 'm3u8' or src_ext == 'm3u8':