Skip to content

Commit

Permalink
fix: now vkVideo also support video URL that start with 'vk.com/videos'
Browse files Browse the repository at this point in the history
  • Loading branch information
nlif-m committed Jun 17, 2023
1 parent 9e4e1ce commit 3446d70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ytdlp/ytdlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (yt *Ytdlp) GetVersion() (version string, err error) {

var youtubeVideoRegexp = regexp.MustCompile(`(https:\/\/|)(www\.|)youtube\.com\/watch\?v=.+`)
var youtubePlaylistRegexp = regexp.MustCompile(`(https:\/\/|)(www\.|)youtube\.com\/playlist\?list=.+`)
var vkVideoRegexp = regexp.MustCompile(`(https:\/\/|)vk\.com\/video-.+`)
var vkVideoRegexp = regexp.MustCompile(`(https:\/\/|)vk\.com\/video(s|).+`)

// TODO: Write a tests
func (yt *Ytdlp) IsDownloadable(rawURL string) (ytType YtdlpURLType, URL string, downloadable bool) {
Expand Down
3 changes: 2 additions & 1 deletion ytdlp/ytdlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ func TestIsDownloadable(t *testing.T) {
{"https://vk.com/video-123891358787_3199312", VkVideoType, true},
{"vk.com/video-123891358787_3199312", VkVideoType, true},
{"vk.com/video-0", VkVideoType, true},
{"vk.com/videos-", VkVideoType, true},

{"youtube./watch?v=123456789zxcvbnasdfqwew", UndefinedType, false},
{"youtube.com/playlist?list=", UndefinedType, false},
{"vk.com/video-", UndefinedType, false},
{"vk.com/video", UndefinedType, false},
}

yt := NewDefault()
Expand Down

0 comments on commit 3446d70

Please sign in to comment.