yt timestamps
This commit is contained in:
parent
bcfab960a4
commit
6b95a798d0
3 changed files with 5 additions and 5 deletions
|
@ -201,9 +201,11 @@ def sanitize(sanitized, noimages=False):
|
|||
for i in re.finditer('" target="_blank">(https://youtube.com/watch\?v\=.*?)</a>', sanitized):
|
||||
url = i.group(1)
|
||||
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
|
||||
url = url.replace("watch?v=", "embed/").replace("&t", "?start").replace("?t", "?start")
|
||||
url = re.sub('(\?start=([0-9]*?))s', r'\1', url)
|
||||
htmlsource = f'<iframe class="embedvid" loading="lazy" src="{url}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
||||
sanitized = sanitized.replace(replacing, htmlsource.replace("watch?v=", "embed/"))
|
||||
|
||||
sanitized = sanitized.replace(replacing, htmlsource)
|
||||
|
||||
for i in re.finditer('<a href="(https://streamable.com/e/.*?)"', sanitized):
|
||||
url = i.group(1)
|
||||
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue