From e55404ad871bd69af3f0b61bb9ab162df1108ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Tue, 21 Nov 2023 04:21:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=AD=A3=E5=88=99=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E7=9A=84=E7=BC=96=E8=AF=91,=E6=8F=90?= =?UTF-8?q?=E9=AB=98=E8=BF=90=E8=A1=8C=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/video.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/models/video.go b/models/video.go index 3208dc7..0507190 100644 --- a/models/video.go +++ b/models/video.go @@ -15,9 +15,14 @@ import ( "github.com/spf13/viper" ) +var ( + imageRegexp = regexp.MustCompile(`image.gameuiux.cn`) + urlRegexp = regexp.MustCompile(`^https?://image.gameuiux.cn/`) +) + func GetVideoM3U8(content string) (playinfo *vod20170321.GetPlayInfoResponseBody, err error) { - if len(regexp.MustCompile(`image.gameuiux.cn`).FindStringSubmatch(content)) > 0 { - key := regexp.MustCompile(`^https?://image.gameuiux.cn/`).ReplaceAllString(content, "") + if len(imageRegexp.FindStringSubmatch(content)) > 0 { + key := urlRegexp.ReplaceAllString(content, "") // 连接点播服务的OSS client, _err := vod20170321.NewClient(&openapi.Config{ AccessKeyId: tea.String(viper.GetString("video.accessID")),