Multi-Browser Crawler
A focused browser automation package for web scraping and content extraction.
Features
- Browser Pool Management: Auto-scaling browser pools with session management
- Proxy Support: Built-in proxy rotation and management
- Image Download: Automatic image capture and localization
- API Discovery: Network request capture and pattern matching
- Session Persistence: Stateful browsing with cookie/session support
Installation
pip install multi-browser-crawler
Quick Start
import asyncio
from multi_browser_crawler import BrowserPoolManager, BrowserConfig
async def main():
# Simple configuration
config = BrowserConfig(headless=True, timeout=30)
pool = BrowserPoolManager(config.to_dict())
try:
await pool.initialize()
# Fetch HTML
result = await pool.fetch_html(
url="https://example.com",
session_id="my_session"
)
if result['status']['success']:
print(f"✅ Success! Title: {result.get('title', 'N/A')}")
print(f"HTML size: {len(result.get('html', ''))} characters")
else:
print(f"❌ Error: {result['status'].get('error')}")
finally:
await pool.shutdown()
if __name__ == "__main__":
asyncio.run(main())
Configuration Options
config = BrowserConfig(
headless=True, # Run in headless mode
timeout=30, # Page load timeout (seconds)
min_browsers=1, # Minimum browsers in pool
max_browsers=5, # Maximum browsers in pool
proxy_url="http://proxy:8080", # Optional proxy URL
download_images_dir="/tmp/images" # Image download directory
)
API Methods
fetch_html()
result = await pool.fetch_html(
url="https://example.com",
session_id="optional_session", # For persistent sessions
timeout=30, # Request timeout
api_patterns=["*/api/*"], # Capture API calls
images_to_capture=["*.jpg", "*.png"] # Download images
)
Response format:
{
'status': {'success': True, 'url': '...', 'load_time': 1.23},
'html': '<html>...</html>',
'title': 'Page Title',
'api_calls': [...], # Captured API requests
'images': [...] # Downloaded images
}
Session Management
# Persistent session - maintains cookies/state
result1 = await pool.fetch_html(url="https://site.com/login", session_id="user1")
result2 = await pool.fetch_html(url="https://site.com/profile", session_id="user1")
# Non-persistent - fresh browser each time
result3 = await pool.fetch_html(url="https://site.com", session_id=None)
Proxy Support
# Single proxy
config = BrowserConfig(proxy_url="http://proxy:8080")
# The package integrates with rotating-mitmproxy for advanced proxy rotation
Testing
# Run all tests
python -m pytest tests/ -v
# Run specific test categories
python -m pytest tests/ -m "not slow" -v
License
MIT License - see LICENSE file for details.
Metadata
Release files for multi-browser-crawler 0.5.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| multi_browser_crawler-0.5.5.tar.gz | 52.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multi_browser_crawler-0.5.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 111.0 kB
Release files / multi_browser_crawler-0.5.5.tar.gz
| Download URL | multi_browser_crawler-0.5.5.tar.gz |
|---|---|
| Size | 52.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49a803da8b0cfe8843c1d0326b5931251241d997a99746c8ee4f8401b8bcd032
|
|
BLAKE2b-256 checksum How to use checksums |
2e9d1595a5309b041d212466521df874a17fc7844837e5e1d01061c5ecc667a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / multi_browser_crawler-0.5.5-py3-none-any.whl
| Download URL | multi_browser_crawler-0.5.5-py3-none-any.whl |
|---|---|
| Size | 58.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d44c8b86495a18f8df88198cbc6db5090f71b970801605a163bf7f8725077f43
|
|
BLAKE2b-256 checksum How to use checksums |
eb045c091e07b9ed6f8215c775f7d12c5c9c960c7dc89aec0deb645ec8fc0473
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for multi-browser-crawler 0.5.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.