update wait for list feed and get feed details (#52)
更新一下 list-feed,get-feed-detail 行为的等待, 这里可能是 windows 的问题所在
This commit is contained in:
@@ -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__) {
|
||||
|
||||
Reference in New Issue
Block a user