Ubuntu
commited on
Commit
·
212a714
1
Parent(s):
834944f
update data
Browse files
app.py
CHANGED
@@ -90,10 +90,12 @@ def embed_youtube(youtube_url):
|
|
90 |
if youtube_url:
|
91 |
try:
|
92 |
# video_id = YoutubeDL().extract_info(youtube_url, download=False)['id']\
|
93 |
-
|
|
|
94 |
if 'short' in youtube_url:
|
95 |
-
print(video_id.split("/"))
|
96 |
video_id = video_id.split("/")[-1]
|
|
|
|
|
97 |
print(video_id)
|
98 |
embed_html = f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>'
|
99 |
return gr.update(value=embed_html, visible=True), "", None
|
|
|
90 |
if youtube_url:
|
91 |
try:
|
92 |
# video_id = YoutubeDL().extract_info(youtube_url, download=False)['id']\
|
93 |
+
if 'v=' in youtube_url:
|
94 |
+
video_id = youtube_url.split("v=")[1]
|
95 |
if 'short' in youtube_url:
|
|
|
96 |
video_id = video_id.split("/")[-1]
|
97 |
+
else:
|
98 |
+
raise Exception("Unsupported URL format")
|
99 |
print(video_id)
|
100 |
embed_html = f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>'
|
101 |
return gr.update(value=embed_html, visible=True), "", None
|