Skip to content

hustcolin/pi-web-bing-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-web-bing-search

Bing web search for Pi coding agent and Claude Code. Zero config, no API key needed. Scrapes cn.bing.com — works great in China without VPN.

Why

Existing web search extensions rely on services blocked or limited in China:

Tool Problem
pi-web-access Uses Google/Gemini — blocked in China
pi-websearch DuckDuckGo default — blocked in China
pi-search-hub Brave only 2000 free queries/month — runs out fast

pi-web-bing-search uses cn.bing.com directly:

  • No API key — zero configuration
  • No monthly quota — unlimited searches (rate-limited only)
  • Works in Chinacn.bing.com fully accessible
  • Lightweight — pure HTTP, no browser/ffmpeg dependencies
  • Zero npm deps — only Node.js built-ins (fetch, regex)

Two ways to use

Way 1: Pi extension (with web_search tool, recommended)

pi install git:github.com/hustcolin/pi-web-bing-search

After installing, just ask:

Search for 马斯克 最新动态

Or use tools directly:

web_search({ query: "Elon Musk latest news" })
web_search({ queries: ["Elon Musk Tesla news", "马斯克 SpaceX 最新进展"] })
get_search_content({ responseId: "a1b2c3d4" })

Features: structured tool schema, progress updates, TUI rendering, result caching, /bing-status command.

Way 2: Standalone script (for Claude Code / any agent)

node <path>/bing-search.js "<query>"
# Multiple queries (auto-dedup):
node <path>/bing-search.js "query1" "query2"

Returns clean JSON:

{
  "query": "Elon Musk latest news",
  "results": [
    {
      "title": "Elon Musk - Wikipedia",
      "url": "https://en.wikipedia.org/wiki/Elon_Musk",
      "snippet": "Elon Reeve Musk is a businessman known for his key roles in Tesla, SpaceX, X (formerly Twitter)..."
    }
  ]
}

In Claude Code: Add to your CLAUDE.md:

## Web Search
When the user asks for current information, use Bing search:
node /path/to/bing-search.js "<query>"
Cite the source URLs in your answer.

In Pi: The skill is auto-loaded when you pi install — or manually via /skill:bing-search.

Project structure

pi-web-bing-search/
├── index.ts              # Pi extension (free-code tool registration)
├── bing-search.js        # Standalone CLI script (no dependencies)
├── skills/
│   └── bing-search/
│       └── SKILL.md      # Skill description for Pi / Claude Code
├── package.json          # Pi package manifest
└── README.md             # This file

Tools (Pi extension)

Tool Description
web_search Search Bing. Supports query or queries (multiple). Returns titles, URLs, snippets.
get_search_content Retrieve stored results by responseId.

How it works

  1. HTTP GET to https://cn.bing.com/search?q=... with browser User-Agent
  2. Parse <li class="b_algo"> elements for titles, URLs, snippets
  3. Deduplicate across multiple queries
  4. Return compact, token-efficient output

Requirements

  • Node.js 18+ (native fetch)
  • Pi v0.37.3+ (for extension mode)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors