Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightsear

Lightweight web search adapters for Python. Queries multiple search engines and returns merged, structured results. Logic is derived from SearXNG engine implementations. Fetching pages is done by using Scrapling StealthySession.

Supported engines

Engine Key
Google google
Bing bing
DuckDuckGo duckduckgo
Baidu baidu

Installation

(TODO, download the source currently)

pip install lightsear

Requires Python 3.10+.

Usage

import lightsear

# Search all engines
results = lightsear.search("python web scraping")

# Search specific engines
results = lightsear.search("python web scraping", sources=["google", "duckduckgo"])

# With a proxy and custom timeout
results = lightsear.search(
    "python web scraping",
    sources=["google"],
    timeout=30.0,
    proxy="http://127.0.0.1:10808",
)

for r in results:
    print(r.source, r.title, r.url)
    print(r.content)

Each result is a SearchResult dataclass:

@dataclass(frozen=True)
class SearchResult:
    title: str
    content: str  # snippet / description
    url: str
    sources: str   # engine name (splitted by comma)

Development

pip install -e ".[dev]"
pytest

License

Logic adapted from SearXNG (AGPL-3.0-or-later).

About

Lightweight web search based on Python & Scrapling

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages