Progress.
This commit is contained in:
parent
263595fc7e
commit
7bcc67c6d3
@ -17,10 +17,10 @@ def set_link_target_blank(text):
|
||||
element.attrs['rel'] = 'noopener noreferrer'
|
||||
element.attrs['referrerpolicy'] = 'no-referrer'
|
||||
element.attrs['href'] = element.attrs['href'].strip(".")
|
||||
if element.attrs['href'].startswith("https://www.you") and "?v=" in element.attrs["href"]:
|
||||
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>'
|
||||
element.replace_with(BeautifulSoup(embed_template, 'html.parser'))
|
||||
#if element.attrs['href'].startswith("https://www.you") and "?v=" in element.attrs["href"]:
|
||||
# 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>'
|
||||
# element.replace_with(BeautifulSoup(embed_template, 'html.parser'))
|
||||
|
||||
return str(soup)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user