update wait for list feed and get feed details (#52)

更新一下 list-feed,get-feed-detail 行为的等待,
这里可能是 windows 的问题所在
This commit is contained in:
zy
2025-09-10 00:30:31 +08:00
committed by GitHub
parent 8338252ab5
commit f21183fa48
2 changed files with 5 additions and 11 deletions

View File

@@ -22,8 +22,7 @@ func NewFeedsListAction(page *rod.Page) *FeedsListAction {
pp := page.Timeout(60 * time.Second)
pp.MustNavigate("https://www.xiaohongshu.com")
pp.MustWaitStable()
pp.MustWait(`() => window.__INITIAL_STATE__ !== undefined`)
pp.MustWaitDOMStable()
return &FeedsListAction{page: pp}
}
@@ -32,6 +31,8 @@ func NewFeedsListAction(page *rod.Page) *FeedsListAction {
func (f *FeedsListAction) GetFeedsList(ctx context.Context) ([]Feed, error) {
page := f.page.Context(ctx)
time.Sleep(1 * time.Second)
// 获取 window.__INITIAL_STATE__ 并转换为 JSON 字符串
result := page.MustEval(`() => {
if (window.__INITIAL_STATE__) {