shorter youtube code + make 1h38m work
parent
4b71630554
commit
e1aa105f72
|
@ -296,17 +296,9 @@ def handle_youtube_links(url):
|
||||||
if yt_id_regex.fullmatch(id):
|
if yt_id_regex.fullmatch(id):
|
||||||
if not t:
|
if not t:
|
||||||
t = params.get('t', params.get('start', [0]))[0]
|
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'
|
html = f'<lite-youtube videoid="{id}" params="autoplay=1&modestbranding=1'
|
||||||
if t:
|
if t:
|
||||||
html += f'&start={int(t)}'
|
html += f'&start={t}'
|
||||||
html += '"></lite-youtube>'
|
html += '"></lite-youtube>'
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue