feat: add bilibili ios script

This commit is contained in:
徐聪
2024-05-29 17:32:43 +08:00
parent 4599c47bcb
commit 99757954c6
11 changed files with 176 additions and 8 deletions

View File

@@ -114,7 +114,12 @@ func (vc *VideoCrawler) isTargetAchieved() bool {
func (vc *VideoCrawler) exitLiveRoom() error {
log.Info().Msg("press back to exit live room")
return vc.driverExt.Driver.PressBack()
err := vc.driverExt.Driver.PressBack()
time.Sleep(time.Duration(3) * time.Second)
if vc.driverExt.TapByOCR("退出直播间") == nil {
log.Info().Msg("clicked the button to exit the live room successfully")
}
return err
}
const (
@@ -231,6 +236,7 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
log.Error().Err(err).Msg("tap live video failed")
continue
}
currentVideo.Type = VideoType_Live
} else {
// skip entering live room
// only mock simulation play duration
@@ -282,7 +288,8 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
exitLive = true
}
if (!isFeed) && exitLive && currentVideo.Type == VideoType_Live {
// isFeed通过预览流进入内流失败的情况下防止使用退出直播间逻辑影响首次进入内流至少会消费两个直播间才能退出
if !isFeed && exitLive && currentVideo.Type == VideoType_Live {
err = crawler.exitLiveRoom()
if err != nil {
if errors.Is(err, code.TimeoutError) || errors.Is(err, code.InterruptError) {