
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
baidusearch-cli
Advanced tools
A TypeScript library for searching Baidu (百度搜索) programmatically. Inspired by library baidusearch-cli
npm install baidusearch-cli
import { search } from 'baidusearch-cli';
// Basic usage
const results = await search('Node.js');
console.log(results);
// With options
const results = await search('TypeScript', {
numResults: 20,
debug: true,
});
results.forEach((result) => {
console.log(`${result.rank}. ${result.title}`);
console.log(` ${result.abstract}`);
console.log(` ${result.url}\n`);
});
# Install globally
npm install -g baidusearch-cli
# Basic search
baidusearch-cli "Node.js"
# Specify number of results
baidusearch-cli "TypeScript" 20
# Enable debug mode
baidusearch-cli "JavaScript" 10 1
Or use with npx:
npx baidusearch-cli "Node.js"
search(keyword: string, options?: SearchOptions): Promise<SearchResult[]>Search Baidu with the given keyword.
keyword (string): The search keyword (required)options (SearchOptions): Optional configuration
numResults (number): Number of results to return (default: 10)debug (boolean): Enable debug logging (default: false)Promise of SearchResult[]:
interface SearchResult {
title: string; // Result title
abstract: string; // Result abstract/description
url: string; // Result URL
rank: number; // Result ranking
}
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run dev
# Lint code
npm run lint
npm run lint:fix
# Format code
npm run format
npm run format:check
# Type check
npm run type-check
# Run tests
npm test
npm run build - Build the projectnpm run dev - Watch mode for developmentnpm run type-check - Type check without emitting filesnpm run lint - Lint TypeScript filesnpm run lint:fix - Fix linting issuesnpm run format - Format code with Prettiernpm run format:check - Check code formattingnpm run release - Create a new release (auto-detects version bump)npm run release:patch - Create a patch release (1.0.x)npm run release:minor - Create a minor release (1.x.0)npm run release:major - Create a major release (x.0.0)This project uses GitHub Actions for continuous integration and deployment:
CI (.github/workflows/ci.yml)
Release (.github/workflows/release.yml)
v1.0.0)Publish (.github/workflows/publish.yml)
CodeQL (.github/workflows/codeql.yml)
Commitlint (.github/workflows/commitlint.yml)
# Create a new release locally
npm run release:patch # or minor/major
# Push tags
git push --follow-tags origin main
# The release workflow will automatically publish to NPM
To enable automated publishing, add these secrets to your GitHub repository:
NPM_TOKEN - Your NPM automation token (https://www.npmjs.com/settings/~/tokens)Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project follows Conventional Commits:
feat: add new feature
fix: bug fix
docs: documentation changes
style: formatting, missing semi colons, etc
refactor: code refactoring
perf: performance improvements
test: add missing tests
chore: maintenance tasks
MIT
This TypeScript version is based on the original Python implementation.
FAQs
A TypeScript library for searching Baidu (百度搜索) programmatically
We found that baidusearch-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.