From 948b403946bed83188bb86d0be207b6cd50ebcdb Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Thu, 7 Sep 2023 13:45:54 +0800 Subject: [PATCH] fix: check video changed --- hrp/pkg/uixt/video_crawler.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hrp/pkg/uixt/video_crawler.go b/hrp/pkg/uixt/video_crawler.go index e588e692..4c7d887e 100644 --- a/hrp/pkg/uixt/video_crawler.go +++ b/hrp/pkg/uixt/video_crawler.go @@ -178,14 +178,17 @@ func (vc *VideoCrawler) startLiveCrawler(enterPoint PointF) error { swipeFinishTime := time.Now() liveRoom, err := vc.getCurrentVideo() - if err != nil { + if err != nil || liveRoom.Type != VideoType_Live { if vc.failedCount >= 5 { // failed 5 consecutive times return errors.New("get current live event trackings failed 5 consecutive times") } // retry vc.failedCount++ - log.Warn().Int64("failedCount", vc.failedCount).Msg("get current live room failed") + log.Warn(). + Int64("failedCount", vc.failedCount). + Str("videoType", string(liveRoom.Type)). + Msg("get current live room failed") continue } @@ -315,7 +318,9 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) { continue } - if feedVideo.VideoID == crawler.lastVideo.VideoID { + if feedVideo.VideoID == crawler.lastVideo.VideoID && + feedVideo.CacheKey == crawler.lastVideo.CacheKey && + feedVideo.UserName == crawler.lastVideo.UserName { // app event tracking not changed // check and handle popups log.Warn().Msg("feed video event tracking not changed") @@ -333,8 +338,6 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) { // check if live video && run live crawler if enterPoint, isLive := crawler.checkLiveVideo(feedVideo); isLive { // 直播预览流 - // TODO - // screenResult.Live = feedVideo log.Info().Msg("live video found") if !crawler.isLiveTargetAchieved() { if err := crawler.startLiveCrawler(enterPoint); err != nil { @@ -460,7 +463,7 @@ func (vc *VideoCrawler) getCurrentVideo() (video *Video, err error) { } log.Info(). - Interface("videoCaption", video.Caption). + Interface("userName", video.UserName). Msg("get current video success") return video, nil }