Metadata-Version: 2.4
Name: mini_search_engine
Version: 1.0.0
Summary: A simple search engine library scraping Google and DuckDuckGo.
Home-page: https://github.com/yourusername/mini-search-engine
Author: Jules
Author-email: jules@example.com
Project-URL: Bug Reports, https://github.com/yourusername/mini-search-engine/issues
Project-URL: Source, https://github.com/yourusername/mini-search-engine
Keywords: search,google,duckduckgo,scraping,crawler
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: beautifulsoup4
Requires-Dist: lxml
Requires-Dist: certifi
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Mini Search Engine

A flexible Python library that scrapes Google and DuckDuckGo for search results. It supports extensive search features including pagination, safe search, and time filtering.

## Features

-   **Multi-Engine Support**: Search via Google or DuckDuckGo.
-   **Smart Fallback**: Automatically tries the next available engine if the primary one is blocked (e.g., falls back to DuckDuckGo if Google blocks).
-   **Pagination**: Retrieve as many results as you need.
-   **Safe Search**: Control safe search strictness (`strict`, `moderate`, `off`).
-   **Time Filtering**: Filter results by day, week, month, or year.
-   **No API Key Needed**: Uses direct web scraping.

## Installation

You can install the package directly from PyPI:

```bash
pip install mini-search-engine
```

Or install locally from source:

```bash
git clone https://github.com/yourusername/mini-search-engine.git
cd mini-search-engine
pip install .
```

## Usage

```python
from mini_search_engine import SearchEngine
import logging

# Optional: Enable logging to see what's happening under the hood
logging.basicConfig(level=logging.INFO)

engine = SearchEngine()

# Simple Search
results = engine.search("python programming")
for res in results:
    print(res['title'], res['link'])

# Advanced Search with Filters
results = engine.search(
    "latest python news",
    engine="auto",       # Try Google, then DDG
    limit=20,            # Get 20 results (handles pagination automatically)
    safe="strict",       # Strict safe search
    time_range="w"       # Past week
)

print(f"\nFound {len(results)} results:")
for i, res in enumerate(results):
    print(f"#{i+1} [{res['source']}] {res['title']}")
    print(f"Link: {res['link']}")
    print(f"Snippet: {res['snippet']}")
    print("-" * 30)
```

## API Reference

### `search(query, engine="auto", limit=10, safe="moderate", time_range=None)`

-   `query` (str): The search query.
-   `engine` (str): `'google'`, `'ddg'`, or `'auto'`. Defaults to `'auto'`.
-   `limit` (int): Number of results to return. Defaults to `10`.
-   `safe` (str): Safe search level: `'strict'`, `'moderate'`, `'off'`. Defaults to `'moderate'`.
-   `time_range` (str): `'d'` (day), `'w'` (week), `'m'` (month), `'y'` (year). Defaults to `None` (any time).

## License

MIT License
