[FIX] website_event_track_live: Properly catch youtube_video_id
On live youtube videos, url are in reality like this: `https://www.youtube.com/live/<video_id>` which was not properly caught by the regex in its compute Reported during OXP closes odoo/odoo#141910 X-original-commit: fd348c6778138240d67aa778866cd9e4d49c5021 Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -20,7 +20,7 @@ class Track(models.Model):
|
||||
def _compute_youtube_video_id(self):
|
||||
for track in self:
|
||||
if track.youtube_video_url:
|
||||
regex = r'^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*'
|
||||
regex = r'^.*(youtu.be\/|v\/|u\/\w\/|embed\/|live\/|watch\?v=|&v=)([^#&?]*).*'
|
||||
match = re.match(regex, track.youtube_video_url)
|
||||
if match and len(match.groups()) == 2 and len(match.group(2)) == 11:
|
||||
track.youtube_video_id = match.group(2)
|
||||
|
||||
Reference in New Issue
Block a user