Skip to main content

CLI tool to fetch URLs and search the web

Project description

Websearch CLI Logo

Websearch CLI

Fetch URLs and search the web from your terminal. Fast, simple, and extensible.

PyPI Version License Tests Python

Fetch web pages and search the internet - all from your command line.

Why Websearch CLI?

  • Fast - Async HTTP powered by httpx
  • Smart caching - Local cache with TTL and automatic eviction
  • Clean output - HTML to Markdown conversion with XSS protection
  • Type-safe - 100% type-annotated Python

Features

  • Fetch URLs and convert to Markdown
  • Web search via Brave Search API
  • Local caching with TTL and size limits
  • XSS protection and HTML sanitization
  • SPA (Single Page App) detection
  • Retry with exponential backoff

Quick Start

# Install
uv add websearch

# Fetch a URL as Markdown
websearch fetch https://example.com

# Search the web
websearch search "python async tutorial"

# Fetch with options
websearch fetch https://example.com --no-cache --verbose
websearch search "python" -n 20 -t news

Command Overview

Command Description
websearch fetch <url> Fetch URL and convert to Markdown
websearch search <query> Search the web
websearch ping Check if CLI is working

Fetch Options

--refresh, -r       Skip cache and force fresh fetch
--no-cache          Disable caching
--no-verify         Skip SSL certificate verification
--output, -o PATH    Output file path
--verbose, -v        Show verbose output

Search Options

--count, -n <n>      Number of results (1-50, default: 10)
--type, -t <type>   Result type: web, news, images, videos
--output, -o PATH    Output file path
--json               Output raw JSON response
--no-cache           Disable caching

Configuration

Set your Brave API key:

export BRAVE_API_KEY=your_api_key_here

Get your API key at https://brave.com/search/api/

Development

# Clone and install
git clone https://github.com/AliiiBenn/websearch.git
cd websearch
uv sync --dev

# Run tests
uv run pytest

# Lint and type-check
uv run ruff check websearch/
uv run mypy websearch/

# Try it out
uv run websearch fetch https://example.com

Contributing

Contributions are welcome! Feel free to open issues or submit PRs.

License

MIT - See LICENSE for details.

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

better_websearch_cli-0.2.3.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

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

better_websearch_cli-0.2.3-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file better_websearch_cli-0.2.3.tar.gz.

File metadata

  • Download URL: better_websearch_cli-0.2.3.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for better_websearch_cli-0.2.3.tar.gz
Algorithm Hash digest
SHA256 12e8c8d0259940e46961fd13c8f270f8d9054501e96ee710bbac972814691a6d
MD5 7eac55e5f85c58dc7a6b5c9775e1c6b2
BLAKE2b-256 d20ea2ef6da0e610a7cdb938bc3b2c3cbc55544f965c6078f7ac45eef39613a6

See more details on using hashes here.

File details

Details for the file better_websearch_cli-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: better_websearch_cli-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for better_websearch_cli-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 54bef620919915ebcdaf9197b4ae24f8dfd9a16be444087330fce895a1a2ed2c
MD5 f420039118a6cfec1f5a6c925dfef734
BLAKE2b-256 3cdc0af6642f00bda1c936e290f0bddad051a46c5f9da1236020a2ccc83364a2

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