Skip to content

Commit

Permalink
Merge pull request #1108 from butterflyx/fix/yt-shorts
Browse files Browse the repository at this point in the history
[add] RegEx for YT shorts
  • Loading branch information
eugeis authored Nov 6, 2024
2 parents 44dae97 + e01a84b commit 232847b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/tools/youtube/youtube.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (o *YouTube) GetVideoOrPlaylistId(url string) (videoId string, playlistId s
}

// Video ID pattern
videoPattern := `(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]*)`
videoPattern := `(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|(?:s(?:horts)\/)|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]*)`
videoRe := regexp.MustCompile(videoPattern)
videoMatch := videoRe.FindStringSubmatch(url)
if len(videoMatch) > 1 {
Expand Down

0 comments on commit 232847b

Please sign in to comment.