Skip to content

feat(baidu): search returns Baidu's own cards in BaiduSearchResponse.cards (0.86.0, SCR-760) - #106

Merged
0xGhostCasper merged 1 commit into
mainfrom
kasparasizi1/scr-760-baidu-cards
Nov 30, 2026
Merged

0xGhostCasper merged 1 commit into
mainfrom
kasparasizi1/scr-760-baidu-cards

Conversation

@0xGhostCasper

@0xGhostCasper 0xGhostCasper commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

What

baidu.search() returns Baidu's own cards in BaiduSearchResponse.cards.

Baidu mixes its own cards (Baike, its AI answer, images, goods, notes, a map, latest news ...) with the organic results. For a popular term they can take every place on page 1, which came back as an empty results. The API now lists them next to the results.

  • BaiduCard: position, type, title, url, baidu_url, snippet. Every field is nullable.
  • BaiduCard.position is Baidu's number for the place on the page, shared with the organic results. BaiduOrganicResult.position is unchanged (rank among organic results), so the two are not the same sequence.
  • cards is always an array: search() gives an empty one when the answer has no such key.
  • No method signature changes.

Version 0.86.0, changelog entry included.

Checks

npm run lint, npm run typecheck, npm test (537 tests) and npm run build pass, as test.yml runs them.

New tests in tests/baidu.test.ts: "returns Baidu's own cards next to the results" and "gives an empty cards list when the answer has none".

Release

Do not merge or publish before the API change is live. Then: merge, create the GitHub release v0.86.0 (publish.yml pushes to npm).

Note: main already holds 0.85.0 (Twitter community search) and the latest tag is v0.84.0. If 0.85.0 is not tagged first, a 0.86.0 release carries it too; its changelog entry is in place.

Related

🤖 Generated with Claude Code

…cards (0.86.0, SCR-760)

Baidu mixes its own cards (Baike, its AI answer, images, goods, notes, a map,
latest news ...) with the organic results, and for a popular term they can
fill the whole first page, which came back as an empty `results`. The API now
lists them in `cards` (scrape-badger/scrapebadger#3658).

- `BaiduCard`: position, type, title, url, baidu_url, snippet, every field
  nullable. `position` is Baidu's number for the place on the page, shared
  with the organic results; `BaiduOrganicResult.position` is unchanged (rank
  among organic results).
- `BaiduSearchResponse.cards` is always an array: `search()` gives an empty
  one when the answer has no such key.
- No method signature changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@0xGhostCasper
0xGhostCasper merged commit 904a652 into main Nov 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants