Skip to main content

✦ msearchy

Parallel Python Metasearch

Query DuckDuckGo, Bing, Wikipedia, and Brave at once and get one clean schema for text, image, and video results.

msearchy Maintainer: Adarsh Kumar Python 3.10+ Apache 2.0 License

Installation  ·  Usage  ·  CLI  ·  Web Explorer  ·  Issues


Overview

msearchy queries multiple search engines concurrently on a pooled httpx.AsyncClient and merges the results into typed Pydantic models. Each engine runs inside its own timeout and error boundary, so a slow or failing provider never breaks the rest of the response.

Before results return, msearchy unwraps tracking redirects (Bing ck/a, DuckDuckGo /l/?uddg=, and Google /url?q=), removes tracking query parameters (utm_*, fbclid, gclid), merges duplicate URLs, and ranks overlapping hits higher with Reciprocal Rank Fusion.

flowchart LR
    Q[Query] --> E[Searchy Engine<br/>Pool + TTL Cache]
    E --> D[DuckDuckGo]
    E --> B[Bing]
    E --> W[Wikipedia]
    E --> Br[Brave]
    D & B & W & Br --> R[Unwrap · Dedup · RRF Rank]
    R --> O[SearchResponse / CLI / Web UI]

Engines

Engine Text Images Videos Notes
duckduckgo Yes Yes Yes Lite HTML with ad filtering and /l/?uddg= decoding; cached vqd shared across images and videos
bing Yes Yes Yes Decodes ck/a base64url links; reads image dimensions and video durations
wikipedia Yes Yes No MediaWiki search API and Wikimedia Commons bitmaps
brave Yes No No Extracts titles cleanly without breadcrumb prefixes

Installation

python -m pip install msearchy
# The distribution is msearchy; the Python import is searchy.

Optional extras:

pip install "msearchy[http2]"   # HTTP/2 support via h2
pip install -e ".[dev]"         # Local development + tests

Usage

Synchronous

from searchy import SearchCategory, Searchy

client = Searchy(timeout=8.0, cache_ttl=60.0)

res = client.search("python asyncio", category=SearchCategory.TEXT, limit_per_provider=5)
print(res.unique_results, res.total_results, res.provider_counts)

bundle = client.search_all("mountain", limit_per_provider=3)
print(bundle.text.unique_results, bundle.images.unique_results, bundle.videos.unique_results)

Asynchronous

Open Searchy with async with to reuse one keep-alive connection pool across queries, or stream engines as they finish with astream():

import asyncio
from searchy import SearchCategory, Searchy


async def main() -> None:
    async with Searchy(timeout=6.0, cache_ttl=60.0) as client:
        res = await client.asearch("postgresql indexing", SearchCategory.TEXT, limit_per_provider=5)
        for item in res.results:
            print(f"{item.score:.4f}  {item.providers_matched}  {item.title} -> {item.url}")

        async for report, items in client.astream("rust web server", SearchCategory.TEXT):
            print(report.provider, f"{report.elapsed_ms} ms", len(items))


asyncio.run(main())

Output schema

{
  "query": "python asyncio",
  "category": "text",
  "total_results": 10,
  "unique_results": 8,
  "elapsed_ms": 184.2,
  "cache_hit": false,
  "provider_counts": { "duckduckgo": 3, "bing": 3, "wikipedia": 2, "brave": 2 },
  "results": [
    {
      "category": "text",
      "provider": "duckduckgo",
      "title": "asyncio — Asynchronous I/O",
      "url": "https://docs.python.org/3/library/asyncio.html",
      "domain": "docs.python.org",
      "score": 0.032787,
      "providers_matched": ["duckduckgo", "bing"]
    }
  ]
}

CLI

# Framed terminal panels across all categories
searchy "python asyncio" --category all --limit 5

# Filter providers and export JSON or Markdown
searchy "linux namespaces" -p duckduckgo wikipedia --format markdown
searchy "fastapi" --json

# Stream each engine as soon as it responds
searchy "sqlite wal mode" --stream

Formats: pretty (default), compact, json, and markdown. Use --no-dedup, --no-rank, --timeout, or --no-color to control output and behavior.

Web explorer

Start the built-in local interface (stdlib HTTP server, no extra dependencies):

searchy --serve --host 127.0.0.1 --port 8080
# or
searchy-web --host 127.0.0.1 --port 8080

Includes category tabs, provider toggles, latency bars, JSON and Markdown views, a URL unwrapper tool, and a local demo mode for testing offline. Open http://127.0.0.1:8080 in your browser.

Security: The built-in server defaults to 0.0.0.0 and has no authentication or TLS. Use the explicit loopback host above for local access; do not expose it to untrusted networks. Provider results and links are untrusted. Live providers can change their pages, block requests, or return no results; queries are sent to the selected third-party services.

Custom providers

Subclass BaseProvider and register it on any Searchy client:

import httpx
from searchy import BaseProvider, SearchCategory, SearchResult, Searchy


class CustomProvider(BaseProvider):
    name = "custom"
    supports_text = True

    async def search_text(
        self, client: httpx.AsyncClient, query: str, limit: int = 10
    ) -> list[SearchResult]:
        resp = await self._request(client, "GET", "https://example.com/api", params={"q": query})
        return [
            SearchResult(
                category=SearchCategory.TEXT,
                provider=self.name,
                title=row["title"],
                url=row["url"],
                snippet=row.get("snippet") or "",
            )
            for row in resp.json()[:limit]
        ]


client = Searchy()
client.register_provider(CustomProvider())

Publishing

See PUBLISHING.md for PyPI upload and GitHub Trusted Publishing instructions.

Development

pytest -v
ruff check searchy tests
mypy searchy

Maintained by Adarsh Kumar · Apache 2.0 License

Metadata

Release files for msearchy 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for msearchy 2.0.0
File Size Uploaded Provenance Actions
msearchy-2.0.0.tar.gz 47.7 kB Without provenance Details for msearchy-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for msearchy 2.0.0
File Interpreter ABI Platform Actions
msearchy-2.0.0-py3-none-any.whl Python 3 none any Details for msearchy-2.0.0-py3-none-any.whl

Total release size: 91.5 kB

Release files / msearchy-2.0.0.tar.gz

Download URL msearchy-2.0.0.tar.gz
Size 47.7 kB
Tags Source
SHA-256 checksum
How to use checksums
68aaf4ed128542d63094be1b2ac10cf54d7c65b8d2cef450a575f003e6008f63
BLAKE2b-256 checksum
How to use checksums
4df3c93241fb930f974ac743506c6185d9835eff6ac1e28b5068359081406cfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Release files / msearchy-2.0.0-py3-none-any.whl

Download URL msearchy-2.0.0-py3-none-any.whl
Size 43.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2acb058cbe1672e24191de82d81ceceec2bfec535518152a4a0d38ef46eebf7
BLAKE2b-256 checksum
How to use checksums
760a128125e78d87e668078650e71adbdd5ca664159cade22e3d943b0163135b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Security for msearchy 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page