Progress.

This commit is contained in:
retoor 2025-02-16 22:53:28 +01:00
parent 263595fc7e
commit 7bcc67c6d3

View File

@ -17,10 +17,10 @@ def set_link_target_blank(text):
element.attrs['rel'] = 'noopener noreferrer' element.attrs['rel'] = 'noopener noreferrer'
element.attrs['referrerpolicy'] = 'no-referrer' element.attrs['referrerpolicy'] = 'no-referrer'
element.attrs['href'] = element.attrs['href'].strip(".") element.attrs['href'] = element.attrs['href'].strip(".")
if element.attrs['href'].startswith("https://www.you") and "?v=" in element.attrs["href"]: #if element.attrs['href'].startswith("https://www.you") and "?v=" in element.attrs["href"]:
video_name = element.attrs["href"].split("?v=")[1].split("&")[0] # video_name = element.attrs["href"].split("?v=")[1].split("&")[0]
embed_template = f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{video_name}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>' # embed_template = f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{video_name}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>'
element.replace_with(BeautifulSoup(embed_template, 'html.parser')) # element.replace_with(BeautifulSoup(embed_template, 'html.parser'))
return str(soup) return str(soup)