Skip to content

Commit

Permalink
extractors/youtube: fix vid regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
iawia002 committed Mar 17, 2018
1 parent 424b5d2 commit 21c7fcf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion extractors/youtube.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func getSig(sig, js string) string {
func Youtube(uri string) downloader.VideoData {
vid := utils.MatchOneOf(
uri,
`watch\?v=(\w+)`,
`watch\?v=([^/&]+)`,
`youtu\.be/([^?/]+)`,
`embed/([^/?]+)`,
`v/([^/?]+)`,
Expand Down
9 changes: 9 additions & 0 deletions extractors/youtube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func TestYoutube(t *testing.T) {
Quality: "hd720",
},
},
{
name: "normal test",
args: test.Args{
URL: "https://www.youtube.com/watch?v=ASPku-eAZYs",
Title: "怪獸與葛林戴華德的罪行 | HD首版電影預告大首播 (Fantastic Beasts: The Crimes of Grindelwald)",
Size: 18330678,
Quality: "hd720",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 21c7fcf

Please sign in to comment.