Repository navigation
feat(baidu): search returns Baidu's own cards in BaiduSearchResponse.cards (0.86.0, SCR-760) - #106
Merged
Merged
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
baidu.search()returns Baidu's own cards inBaiduSearchResponse.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.positionis Baidu's number for the place on the page, shared with the organic results.BaiduOrganicResult.positionis unchanged (rank among organic results), so the two are not the same sequence.cardsis always an array:search()gives an empty one when the answer has no such key.Version 0.86.0, changelog entry included.
Checks
npm run lint,npm run typecheck,npm test(537 tests) andnpm run buildpass, astest.ymlruns 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.ymlpushes to npm).Note:
mainalready holds 0.85.0 (Twitter community search) and the latest tag isv0.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
cards(SCR-760) docs#218🤖 Generated with Claude Code