A simple search engine library scraping Google and DuckDuckGo.
Project description
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:
pip install mini-search-engine
Usage
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 to10.safe(str): Safe search level:'strict','moderate','off'. Defaults to'moderate'.time_range(str):'d'(day),'w'(week),'m'(month),'y'(year). Defaults toNone(any time).
License
MIT License
Credits
This library was developed with extensive assistance from the Jules AI coding assistant.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mini_search_engine-1.0.1.tar.gz.
File metadata
- Download URL: mini_search_engine-1.0.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdf0f37edad5fb79f1b722e0215c793fe9597ffbf1349f2d04edebe76a827596
|
|
| MD5 |
b094df35169aa2c5f5ffb09aa5c383a6
|
|
| BLAKE2b-256 |
226451275b1e9c9fd246a33fd841a20013f45efa6ef254dd920d02572798a84e
|
Provenance
The following attestation bundles were made for mini_search_engine-1.0.1.tar.gz:
Publisher:
python-publish.yml on Shrisal/Web-Search-Python-Library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mini_search_engine-1.0.1.tar.gz -
Subject digest:
bdf0f37edad5fb79f1b722e0215c793fe9597ffbf1349f2d04edebe76a827596 - Sigstore transparency entry: 925817199
- Sigstore integration time:
-
Permalink:
Shrisal/Web-Search-Python-Library@c34e66e0b2b977937f033341a92b558ead25b02e -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Shrisal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c34e66e0b2b977937f033341a92b558ead25b02e -
Trigger Event:
release
-
Statement type:
File details
Details for the file mini_search_engine-1.0.1-py3-none-any.whl.
File metadata
- Download URL: mini_search_engine-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e92a5b0b2e4f155a1b8bb827b5d7fc8cb8e18db181bd133ad881d105d354e89e
|
|
| MD5 |
f439728fd971f42d471a404d9bdace95
|
|
| BLAKE2b-256 |
c0b26a6c40c461c00f4e383bba57868c53227c8b4c4607c1818d65a56b16e18c
|
Provenance
The following attestation bundles were made for mini_search_engine-1.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on Shrisal/Web-Search-Python-Library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mini_search_engine-1.0.1-py3-none-any.whl -
Subject digest:
e92a5b0b2e4f155a1b8bb827b5d7fc8cb8e18db181bd133ad881d105d354e89e - Sigstore transparency entry: 925817210
- Sigstore integration time:
-
Permalink:
Shrisal/Web-Search-Python-Library@c34e66e0b2b977937f033341a92b558ead25b02e -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Shrisal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c34e66e0b2b977937f033341a92b558ead25b02e -
Trigger Event:
release
-
Statement type: