Metadata-Version: 2.3
Name: search-tool
Version: 0.2.0
Summary: Tool and library for searching the web and return results
Author: Wensheng Wang
Author-email: wenshengwang@gmail.com
Requires-Python: >=3.11
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Provides-Extra: dev
Requires-Dist: black (>=22.0.0) ; extra == "dev"
Requires-Dist: ddgs (>=9.14.1)
Requires-Dist: flake8 (>=4.0.0) ; extra == "dev"
Requires-Dist: markdownify (>=0.14.1)
Requires-Dist: mypy (>=0.950) ; extra == "dev"
Requires-Dist: playwright (>=1.52.0,<2.0.0)
Requires-Dist: playwright-stealth (>=2.0.3)
Requires-Dist: pydantic (>=2.11.4,<3.0.0)
Requires-Dist: pylint (>=4.0.5) ; extra == "dev"
Requires-Dist: pytest (>=7.0.0) ; extra == "dev"
Requires-Dist: pytest-asyncio (>=1.3.0) ; extra == "dev"
Requires-Dist: pytest-mock (>=3.15.1) ; extra == "dev"
Requires-Dist: readability-lxml (>=0.8.4.1)
Requires-Dist: rookiepy (>=0.5.6)
Requires-Dist: ruff (>=0.15.12) ; extra == "dev"
Requires-Dist: tavily-python (>=0.7.23) ; extra == "dev"
Project-URL: Homepage, https://github.com/wensheng/search-tool
Project-URL: Repository, https://github.com/wensheng/search-tool.git
Description-Content-Type: text/markdown

# Search-Tool

A unified interface and CLI for performing web searches across various search engines using Playwright.

## Installation

```bash
uv tool install search-tool
```

Or use pip/pipx:
```bash
pip install search-tool
pipx install search-tool
```

## Usage

### CLI

```bash
# Basic search
st python decorator

# get first page
st -p1 current weather dallas tx

# Search with a specific engine
st -e brave "Python async programming"

# Sync cookies from Chrome to bypass logins (e.g., for Twitter/X)
st --sync-cookies chrome --sync-domains .x.com .twitter.com
```

### Python API

```python
import asyncio
from search_tool import SearchTool, SearchConfig

async def main():
    config = SearchConfig(search_engine="google", num_results=5)
    async with SearchTool(config) as tool:
        results = await tool.search("OpenAI o3-mini")
        for result in results.web_results:
            print(f"{result.title}: {result.url}")

if __name__ == "__main__":
    asyncio.run(main())
```

## Cookie Syncing

The `--sync-cookies` flag allows you to import logged-in sessions from your existing browser (Chrome, Firefox, Edge, Brave, Safari, Opera) into Playwright's isolated persistent profile. This is particularly useful for:
- Bypassing login screens on social media sites.
- Avoiding captchas.
- Searching authenticated content.

