A fast, multi-source web search library with intelligent fallback and content extraction.
Project description
🚀 Flash-search
A fast, multi-source web search library with intelligent fallback and content extraction capabilities.
Features
✨ Fast Web Search - Search across multiple sources with intelligent fallback (Google + DuckDuckGo)
🔄 Auto Fallback - Automatically uses DuckDuckGo if Google is blocked
📄 Content Extraction - Extract clean, readable text from websites without HTML
💾 Save Results - Export search results and website content to .txt files
🌍 Multi-language - Support for 30+ languages and regions
🔧 Advanced Filtering - Unique results, safe search, pagination support
⚡ Fast Performance - Optimized with curl-cffi for speed and reliability
Installation
pip install flash-search
Quick Start
Basic Search
from flash_search import search
# Get search result URLs
for url in search("Python programming", num_results=5):
print(url)
Advanced Search
from flash_search import search
# Get detailed results with title and description
for result in search("Machine Learning", num_results=5, advanced=True):
print(f"Title: {result.title}")
print(f"URL: {result.url}")
print(f"Description: {result.description}\n")
Extract Website Content
from flash_search import extract_website_content
# Get clean text from a website
content = extract_website_content("https://example.com")
print(content)
Save Results to File
from flash_search import search, save_results_to_file
# Search and save results
results = list(search("Python", num_results=10, advanced=True))
save_results_to_file(results, "results.txt")
Save Website Content
from flash_search import save_website_content
# Extract and save website content
save_website_content("https://python.org", "python_org.txt")
API Reference
search(term, **kwargs)
Search the web for a query.
Parameters:
term(str): Search querynum_results(int): Number of results to return (default: 10)lang(str): Language code (default: "en")advanced(bool): Return SearchResult objects instead of URLs (default: False)timeout(int): Request timeout in seconds (default: 5)unique(bool): Return only unique results (default: False)proxy(str): Proxy URL if neededsafe(str): Safe search ("active" or None)region(str): Country code for region-specific results
Returns: Generator yielding URLs or SearchResult objects
extract_website_content(url)
Extract clean text from a website.
Parameters:
url(str): Website URL
Returns: Clean text content
save_results_to_file(results, filename)
Save search results to a file.
Parameters:
results(list): Search results to savefilename(str): Output filename
save_website_content(url, filename=None)
Extract and save website content.
Parameters:
url(str): Website URLfilename(str): Output filename (auto-generated if None)
How It Works
Flash-search uses a dual-source strategy:
- Primary Source: Uses
curl-cffito impersonate a real browser and fetch Google results - Fallback Source: Automatically switches to DuckDuckGo if Google blocks the request
This ensures reliable search results even when one source is unavailable.
Requirements
- Python 3.6+
- beautifulsoup4 >= 4.9
- requests >= 2.20
- curl-cffi >= 0.5.0
- ddgs >= 9.0.0
- fake-useragent >= 1.0.0
Troubleshooting
Search returns no results:
- Check your internet connection
- Try increasing
sleep_intervalto avoid rate-limiting - The website structure may have changed
"DuckDuckGo fallback not available":
pip install ddgs
License
MIT License - See LICENSE file for details
Disclaimer
This tool is for educational and research purposes. Please respect website terms of service and robots.txt when scraping.
- description
If requesting more than 100 results, googlesearch will send multiple requests to go through the pages. To increase the time between these requests, use `sleep_interval`:
```python
from googlesearch import search
search("Google", sleep_interval=5, num_results=200)
If requesting more than 10 results, but want to manage the batching yourself?
Use `start_num` to specify the start number of the results you want to get:
```python
from googlesearch import search
search("Google", sleep_interval=5, num_results=200, start_num=10)
If you are using a HTTP Rotating Proxy which requires you to install their CA Certificate, you can simply add ssl_verify=False in the search() method to avoid SSL Verification.
from googlesearch import search
proxy = 'http://username:password@proxy.host.com:8080/'
# or for socks5
# proxy = 'socks5://username:password@proxy.host.com:1080/'
j = search("proxy test", num_results=100, lang="en", proxy=proxy, ssl_verify=False)
for i in j:
print(i)
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 flash_search-2.0.0.tar.gz.
File metadata
- Download URL: flash_search-2.0.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec5187fc65bd163c72a821f64c7bd56df8fc6ec9227e65a68d9d547b5c8cb7d7
|
|
| MD5 |
c2fa5a2c4e8809bcf148d53b783aeb13
|
|
| BLAKE2b-256 |
35d133288fc8ef097b423ac95b656f6aa1f71c32695095c42f734b6439d79e85
|
File details
Details for the file flash_search-2.0.0-py3-none-any.whl.
File metadata
- Download URL: flash_search-2.0.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f77124c06ed57d9fd2c736278d2d9e5fce9948a0506541ebddf364234c232335
|
|
| MD5 |
9c95fc037872b6221115036918d19922
|
|
| BLAKE2b-256 |
b5f7021f3183213fffd3664a07f050fdaefbfae311642e635cdd9d96a184e85d
|