Added youtube music url to options for embedding #56

Merged
retoor merged 2 commits from :feat/embed-youtube-music into main 2025-06-19 14:37:18 +02:00

View File

@ -180,6 +180,7 @@ def embed_youtube(text):
or url.hostname or url.hostname
in [ in [
"www.youtube.com", "www.youtube.com",
"music.youtube.com",
"youtube.com", "youtube.com",
"www.youtube-nocookie.com", "www.youtube-nocookie.com",
"youtube-nocookie.com", "youtube-nocookie.com",
@ -330,7 +331,7 @@ def embed_url(text):
attachments = {} attachments = {}
for element in soup.find_all("a"): for element in soup.find_all("a"):
if "href" in element.attrs and element.attrs["href"].startswith("http"): if "href" in element.attrs and element.attrs["href"].startswith("http") and ("data-noembed" not in element.attrs):
page_url = urlparse(element.attrs["href"]) page_url = urlparse(element.attrs["href"])
page = get_url_content(element.attrs["href"]) page = get_url_content(element.attrs["href"])
if page: if page:
@ -556,3 +557,4 @@ class PythonExtension(Extension):
return "".join(to_write) return "".join(to_write)
return str(fn(caller())) return str(fn(caller()))