fish2018/pansou · error

[ ] 搜索请求失败

Error message

[%s] 搜索请求失败: %w

What it means

The gaoqing888 plugin could not fetch/parse the search page document: fetchDocument (which performs the HTTP request with retries and loads it via goquery) returned an error. The plugin surfaces it wrapped with its plugin name, aborting the search.

Solutions

  1. Check connectivity to the gaoqing888 site (curl the searchURL).
  2. Inspect the wrapped fetchDocument error: 'HTTP %d' means server-side, transport error means network/DNS/proxy.
  3. Increase searchTimeout if the site responds slowly.
  4. Refresh cookies/User-Agent if the site enforces anti-bot checks.
Defensive patterns

Strategy: try-catch

Validate before calling

// check reachability before invoking the plugin
resp, err := client.Head(baseURL)
if err != nil || resp.StatusCode >= 400 {
    log.Printf("gaoqing888 site unreachable (err=%v status=%d)", err, statusOf(resp))
}

Try / catch

results, err := plugin.Search(keyword)
if err != nil {
    if strings.Contains(err.Error(), "搜索请求失败") {
        log.Printf("gaoqing888 fetch failed: %v", err)
        return fallbackToOtherPlugins(keyword)
    }
    return err
}

Prevention

When it happens

Trigger: fetchSearchResults: fetchDocument(client, requestURL, searchTimeout, baseURL+"/") failed — i.e. the HTTP GET to the search URL failed or the response could not be parsed into a document.

Common situations: Site down or unreachable, searchTimeout too short on slow connections, site blocks the client (403/captcha), DNS or proxy misconfiguration.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/c5e26b55bb89f764. Report an issue: GitHub.

Appendix: source

Thrown at plugin/gaoqing888/gaoqing888.go:143

				Channel:  "",
				Datetime: time.Now(),
			}

			mu.Lock()
			results = append(results, result)
			mu.Unlock()
		}(item)
	}

	wg.Wait()
	return plugin.FilterResultsByKeyword(results, keyword), nil
}

func (p *Gaoqing888Plugin) fetchSearchResults(client *http.Client, keyword string) ([]articleItem, error) {
	requestURL := fmt.Sprintf(searchURL, url.QueryEscape(keyword))
	doc, err := fetchDocument(client, requestURL, searchTimeout, baseURL+"/")
	if err != nil {
		return nil, fmt.Errorf("[%s] 搜索请求失败: %w", p.Name(), err)
	}

	items := make([]articleItem, 0)
	doc.Find("div.wp-list.search-list div.video-row").Each(func(_ int, s *goquery.Selection) {
		titleLink := s.Find("a.title-link").First()
		title := cleanText(titleLink.Text())
		detailURL, ok := titleLink.Attr("href")
		if !ok || title == "" || detailURL == "" {
			return
		}

		id := extractDetailID(detailURL)
		if id == "" {
			return
		}

		imageURL := strings.TrimSpace(s.Find("a.cover-link img.cover").AttrOr("src", ""))
		content := cleanText(strings.Join([]string{

View on GitHub (pinned to beaa561337)