Skip to main content

Web search, fetch, and paper-research toolkit.

Project description

wesearch

Web search, fetch, and paper-research toolkit.

wesearch is a synchronous, batteries-included library for programmatic web access: run a search, fetch a page through a real-browser fingerprint, extract content, and look up scholarly papers across multiple providers. It is the web layer factored out of a larger agent stack, so it is built to survive bot-detection, rate limits, and flaky endpoints without a running browser in the common case.

What's inside

wesearch/
├── search.py        search(...) over DuckDuckGo (+ configured backends);
│                      SearchResult / PaperResult / ImageResult
├── fetch/           the sole HTTP egress
│   ├── fetch.py     fetch(url, request=RequestParams(...)) -> (body, meta)
│   ├── curl.py      curl-cffi transport (TLS/JA3 browser impersonation)
│   ├── stdlib.py    dependency-free urllib transport
│   ├── zendriver.py opt-in real-Chrome backend for JS-gated pages
│   ├── transport_routing.py  per-domain transport selection
│   └── challenge.py bot-challenge detection and classification
├── chrome/          real-browser fingerprints
│   ├── headers.py   Chrome request headers (incl. x-browser-validation)
│   └── useragents.py  vendored, refreshable User-Agent pools
├── profile.py       cross-process per-(egress_ip, domain) cookie + UA jar
├── ratelimit.py     cross-process, per-domain rate limiting
├── scrape.py        get_element_content(html, selector)
├── errors.py        FetchError, BotDetectionError + subclasses
└── paper/           scholarly-paper lookup
    ├── search.py    search(...) across Semantic Scholar, OpenAlex, SearXNG
    ├── details.py   metadata / references / citations / cited_by
    ├── authors.py   author search and publication lists
    ├── fetch.py     PDF download cascade
    └── providers/   per-source backends (openalex, s2, searxng)

Usage

from wesearch.search import search
from wesearch.fetch import RequestParams, fetch
from wesearch.scrape import get_element_content

# Search
hits = search("denoising recursion models", limit=10)
for r in hits:
    print(r.title, r.url)

# Fetch + scrape
body, _meta = fetch("https://example.com", request=RequestParams(timeout_sec=10))
title = get_element_content(body.decode("utf-8"), "h1")

# Papers
from wesearch.paper.search import search as paper_search
from wesearch.paper.ids import normalize_id
from wesearch.paper.details import metadata

for rec in paper_search("attention is all you need", limit=5):
    print(rec.title, rec.year)
meta = metadata(*normalize_id("arXiv:1706.03762"))

Each name is imported from the submodule that defines it; the top-level __init__ re-exports nothing.

Transports

fetch picks a transport per domain:

  • curl-cffi (default): TLS/JA3 browser impersonation, no browser process.
  • stdlib: dependency-free urllib fallback.
  • zendriver: an opt-in headless-Chrome backend for JavaScript-gated pages, used only for domains that require it.

A persistent per-(egress_ip, domain) profile (cookies + User-Agent) is loaded and saved transparently, and cross-process rate limiting paces requests so concurrent workers stay under each site's threshold.

Roadmap

An MCP server exposing search / fetch / paper-lookup as tools for coding agents is planned, so an agent can call the toolkit directly.

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wesearch-0.1.0.tar.gz (260.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wesearch-0.1.0-py3-none-any.whl (154.0 kB view details)

Uploaded Python 3

File details

Details for the file wesearch-0.1.0.tar.gz.

File metadata

  • Download URL: wesearch-0.1.0.tar.gz
  • Upload date:
  • Size: 260.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wesearch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e5fa1531f693cb3f2a89fe69547529f7de3e885491da3e5b544f3f9b7ffd0513
MD5 2ee32af50ccbf128b3bf7ab794f6962b
BLAKE2b-256 bebce88970cc26510734b70750c57f0f98f79dfcc2cc3683e8d178e9d3e135dc

See more details on using hashes here.

File details

Details for the file wesearch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wesearch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 154.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wesearch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c35a06c86c16dfc18a866bd86bf4fcc320f0f645cf5c3ff66155c375d38c456
MD5 c97f03557f8fa0c4af7e9010dc0b1d85
BLAKE2b-256 df42a597c3d8b01d49b5875e37761a4a16c7e8c8fd0070aae4bae2b71f960175

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page