xpzouying/xiaohongshu-mcp · warning

ErrNoFeeds

ErrNoFeeds

Error message

没有捕获到 feeds 数据

What it means

ErrNoFeeds is a sentinel error (errors.New) indicating the scraper captured an empty string instead of feeds data after extracting from the page. GetFeedsList and Search return it when their result variable is empty, meaning the DOM selectors or the extraction pipeline found nothing. It signals the page data was not captured, not a network failure per se.

Source

Thrown at errors/errors.go:5

package errors

import "errors"

var ErrNoFeeds = errors.New("没有捕获到 feeds 数据")
var ErrNoFeedDetail = errors.New("没有捕获到 feed 详情数据")

View on GitHub (pinned to 332d196854)

Solutions

  1. Check that the user session is logged in and not hit by a verification wall before calling GetFeedsList/Search
  2. Log the page HTML when this occurs and update the extraction selectors in xiaohongshu/feeds.go / search.go if the site markup changed
  3. Retry with a different keyword or after a delay/humanized navigation (humanize.Hover/Click) to appear less bot-like
  4. Treat empty results as a valid business outcome: handle ErrNoFeeds as 'no data' rather than retrying blindly

Example fix

// before
feeds, err := xhs.GetFeedsList(ctx, keyword)
if err != nil { log.Fatal(err) }
// after
feeds, err := xhs.GetFeedsList(ctx, keyword)
if errors.Is(err, errors.ErrNoFeeds) {
    log.Println("no feeds for keyword, skipping")
    return nil
} else if err != nil {
    log.Fatal(err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: no pre-validation possible for page data; guard at call site
if keyword == "" { return fmt.Errorf("keyword required") }

Type guard

func isNoFeeds(err error) bool { return errors.Is(err, errors.ErrNoFeeds) }

Try / catch

feeds, err := xhs.GetFeedsList(ctx, kw)
switch {
case errors.Is(err, errors.ErrNoFeeds):
    log.Printf("no feeds for %q", kw) // business-empty, not failure
case err != nil:
    return err
}

Prevention

When it happens

Trigger: Calling xiaohongshu GetFeedsList or Search when the extraction JS evaluates to an empty string — e.g. xiaohongshu/feeds.go:57 and xiaohongshu/search.go:157 both do `if result == "" { return nil, errors.ErrNoFeeds }`. Typically after a keyword search that returns no notes, or when the page layout changed so the extraction script returns empty.

Common situations: Searching a keyword with no results; XHS requiring login/verification so feeds render nothing; anti-bot interception returning an empty shell page; frontend redesign changing selectors so the injected extraction script yields empty output.

Related errors


AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05). Data as JSON: /api/errors/9f195feae629a332. Report an issue: GitHub.