mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
fix: incr feed
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user