Skip to content

Commit

Permalink
20200403 更正视频链接地址
Browse files Browse the repository at this point in the history
  • Loading branch information
univerone committed Apr 3, 2020
1 parent 20bec81 commit f40a2d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions parser/datacamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func GetPK(url string)(string){
func GetDCVideo(url string)(string,string){
data:=utils.HttpGet(url)
videoUrl:= "https:"+utils.MatchAll(data,`video_mp4_link.*?(//.*?)"`)[0][1]
videoUrl = utils.Replace(videoUrl,"amp;","")
subtitleUrl := utils.MatchAll(data,`subtitle_vtt_link.*?(https.*?vtt)`)[0][1]
return videoUrl,subtitleUrl
}
Expand Down
8 changes: 8 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ func Format(str string)string{
return res
}

//替换
func Replace(str string,pattern string,new string)string{
re := regexp.MustCompile(pattern)
res := re.ReplaceAllString(str, new)
return res
}


// 符合某一个正则表达式
func MatchOneOf(text string, patterns ...string) []string {
var (
Expand Down

0 comments on commit f40a2d4

Please sign in to comment.