|
|
@ -6,6 +6,7 @@ import ( |
|
|
|
"main_program/entity" |
|
|
|
service "main_program/service" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
|
type keywordAnalyse struct{} |
|
|
@ -32,7 +33,8 @@ func (m *keywordAnalyse) Start() { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
continueFlag := true |
|
|
|
for continueFlag { |
|
|
|
config.Logger.Infof("需要解析的VideoId:%s", videoId) |
|
|
|
|
|
|
|
// 根据videoId获取channel
|
|
|
@ -61,6 +63,26 @@ func (m *keywordAnalyse) Start() { |
|
|
|
for i := 0; i < len(srtFiles); i++ { |
|
|
|
analyse(srtFiles[i], keywords) |
|
|
|
} |
|
|
|
|
|
|
|
// 5秒后循环获取
|
|
|
|
config.Logger.Info("5秒后循环获取") |
|
|
|
time.Sleep(5 * time.Second) |
|
|
|
if common.AnalyseRegion == "" { |
|
|
|
videoId, err = service.SrtFileService.QueryOneNotScanVideoId() |
|
|
|
if err != nil { |
|
|
|
config.Logger.Info("没有需要解析的SrtFile...") |
|
|
|
continueFlag = false |
|
|
|
} |
|
|
|
} else { |
|
|
|
config.Logger.Info("通过common.AnalyseRegion获取VideoId") |
|
|
|
videoId, err = service.SrtFileService.QueryOneNotScanVideoIdByRegion(common.AnalyseRegion) |
|
|
|
if err != nil { |
|
|
|
config.Logger.Info("没有需要解析的SrtFile...") |
|
|
|
continueFlag = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func analyse(srtFile entity.Srtfile, keywords []entity.Keyword) { |
|
|
|