[add] VideoID for YT shorts

This commit is contained in:
butterflyx
2024-11-05 19:55:45 +01:00
parent b98316a705
commit 203add15e5

View File

@@ -60,7 +60,7 @@ func (o *YouTube) GetVideoOrPlaylistId(url string) (videoId string, playlistId s
// Video ID pattern
//https:((youtu.be/7qZl_5xHoBw
videoPattern := `(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})`
videoPattern := `(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|(?:s(?:horts)\/)|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})`
videoRe := regexp.MustCompile(videoPattern)
videoMatch := videoRe.FindStringSubmatch(url)
if len(videoMatch) > 1 {