shorter youtube code + make 1h38m work

remotes/1722233799945163191/master
Aevann 2024-02-13 12:10:05 +02:00
parent 4b71630554
commit e1aa105f72
1 changed files with 1 additions and 9 deletions

View File

@ -296,17 +296,9 @@ def handle_youtube_links(url):
if yt_id_regex.fullmatch(id):
if not t:
t = params.get('t', params.get('start', [0]))[0]
if isinstance(t, str):
t = t.replace('s','').replace('S','')
split = t.split('m')
if len(split) == 2:
minutes = int(split[0])
if split[1]: seconds = int(split[1])
else: seconds = 0
t = minutes*60 + seconds
html = f'<lite-youtube videoid="{id}" params="autoplay=1&modestbranding=1'
if t:
html += f'&start={int(t)}'
html += f'&start={t}'
html += '"></lite-youtube>'
return html