Skip to content

Commit

Permalink
extractors/youku: ⬆️ ccode, 🔧 title, close #137
Browse files Browse the repository at this point in the history
  • Loading branch information
iawia002 committed Jun 2, 2018
1 parent c329a53 commit f1be07e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
6 changes: 4 additions & 2 deletions extractors/youku.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const youkuReferer = "https://v.youku.com"

// var ccodes = []string{"0510", "0502", "0507", "0508", "0512", "0513", "0514", "0503", "0590"}

var ccodes = []string{"0510"}
var ccodes = []string{"0519"}

func youkuUps(vid string) youkuData {
var url string
Expand Down Expand Up @@ -134,7 +134,9 @@ func Youku(url string) downloader.VideoData {
}
format := genData(youkuData.Data)
var title string
if youkuData.Data.Show.Title == "" {
if youkuData.Data.Show.Title == "" || strings.Contains(
youkuData.Data.Video.Title, youkuData.Data.Show.Title,
) {
title = youkuData.Data.Video.Title
} else {
title = fmt.Sprintf("%s %s", youkuData.Data.Show.Title, youkuData.Data.Video.Title)
Expand Down
27 changes: 18 additions & 9 deletions extractors/youku_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,24 @@ func TestYouku(t *testing.T) {
Quality: "mp4hd3v2 1920x1080",
},
},
// {
// name: "normal test",
// args: test.Args{
// URL: "http://v.youku.com/v_show/id_XMzQ1MTAzNjQwNA==.html",
// Title: "这!就是街舞 第一季 第3期:百强“互杀”队长不忍直视",
// Size: 750911635,
// Quality: "mp4hd2v2 1280x720",
// },
// },
{
name: "normal test",
args: test.Args{
URL: "http://v.youku.com/v_show/id_XMzQ1MTAzNjQwNA==.html",
Title: "这!就是街舞 第一季 第3期:百强“互杀”队长不忍直视",
Size: 1419459808,
Quality: "mp4hd3v2 1920x1080",
},
},
{
name: "title test",
args: test.Args{
URL: "http://v.youku.com/v_show/id_XMzYzMDgxMTAyNA.html",
Title: "想看你微笑 01",
Size: 568769655,
Quality: "mp4hd3v2 1920x1080",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit f1be07e

Please sign in to comment.