Skip to content

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

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 SearchResponse.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.

  • Card: position, type, title, url, baidu_url, snippet. Every field is optional.
  • Card.position is Baidu's number for the place on the page, shared with the organic results. OrganicResult.position is unchanged (rank among organic results), so the two are not the same sequence.
  • SearchResponse.cards defaults to an empty list, so an answer without the key parses as before.
  • Exported from scrapebadger.baidu and as scrapebadger.BaiduCard.
  • No method signature changes, so the monorepo's v1 surface lock is not affected.

Version 0.86.0, changelog entry included.

Checks

ruff check, ruff format --check, mypy src/ and pytest --ignore=tests/e2e pass, as test.yml runs them.

New tests in tests/test_baidu.py: test_a_page_of_only_cards_has_cards_and_no_results, test_an_answer_without_cards_parses_to_an_empty_list, test_card_is_exported; test_search_response_keeps_every_field now covers a card.

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 PyPI).

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

… (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).

- `Card`: position, type, title, url, baidu_url, snippet, every field
  optional. `position` is Baidu's number for the place on the page, shared
  with the organic results; `OrganicResult.position` is unchanged (rank among
  organic results).
- `SearchResponse.cards` defaults to an empty list, so answers without the
  key parse as before.
- Exported from `scrapebadger.baidu` and as `scrapebadger.BaiduCard`.
- 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 8edfe43 into main Nov 30, 2026
7 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