fix: incr feed

This commit is contained in:
lilong.129
2023-08-13 10:54:15 +08:00
parent 1f7af5a767
commit 241ee388da
+10 -7
View File
@@ -122,8 +122,7 @@ func (s *VideoStat) incrFeed(screenResult *ScreenResult, driverExt *DriverExt) e
if driverExt.plugin != nil { if driverExt.plugin != nil {
feedVideo, err := getFeedVideo(driverExt.plugin, author) feedVideo, err := getFeedVideo(driverExt.plugin, author)
if err != nil { if err != nil {
log.Error().Err(err).Msg("get feed video from plugin failed") return errors.Wrap(err, "get feed video from plugin failed")
return err
} }
screenResult.Feed = feedVideo screenResult.Feed = feedVideo
} }
@@ -403,13 +402,13 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
} else { } else {
// 点播 // 点播
// check feed type and incr feed count // check feed type and incr feed count
if err := currVideoStat.incrFeed(screenResult, dExt); err != nil { err := currVideoStat.incrFeed(screenResult, dExt)
if err != nil {
log.Error().Err(err).Msg("incr feed failed") log.Error().Err(err).Msg("incr feed failed")
continue } else {
// simulation watch feed video
sleepStrict(lastSwipeTime, screenResult.Feed.PlayDuration)
} }
// simulation watch feed video
sleepStrict(lastSwipeTime, screenResult.Feed.PlayDuration)
} }
// check if target count achieved // check if target count achieved
@@ -444,6 +443,10 @@ func getFeedVideo(plugin funplugin.IPlugin, authorName string) (feedVideo *FeedV
return nil, errors.Wrap(err, "call plugin GetFeedVideo failed") return nil, errors.Wrap(err, "call plugin GetFeedVideo failed")
} }
if resp == nil {
return nil, errors.New("feed not found")
}
feedBytes, err := json.Marshal(resp) feedBytes, err := json.Marshal(resp)
if err != nil { if err != nil {
return nil, errors.New("json marshal feed video info failed") return nil, errors.New("json marshal feed video info failed")