fix: support youtube watch links as preview links

This commit is contained in:
Jannat Patel
2026-03-02 13:01:59 +05:30
parent 94f0f79404
commit f63a4a44a2
2 changed files with 3 additions and 2 deletions

View File

@@ -47,7 +47,9 @@ class LMSCourse(Document):
).save(ignore_permissions=True)
def validate_video_link(self):
if self.video_link and "/" in self.video_link:
if self.video_link and "watch?v=" in self.video_link:
self.video_link = self.video_link.split("watch?v=")[-1]
elif self.video_link and "/" in self.video_link:
self.video_link = self.video_link.split("/")[-1]
def validate_status(self):