A simple, human-friendly web scraper wrapper using httpx, BeautifulSoup, and Playwright.
Project description
Scraper
A simple and practical Python web scraper for real‑world websites. It supports normal HTTP scraping, JavaScript rendering via Playwright, rate limiting, pagination, form submission, file downloads, and structured data extraction.
Designed to be usable, reliable, and flexible.
Features
- HTTP scraping with
httpx - Automatic fallback to browser mode (Playwright) when blocked
- JavaScript rendering support
- Rate limiting
- Parallel fetching
- Table extraction with
rowspan/colspan - Pagination (patterned pages + "Next" button)
- JSON endpoints
- Form submission
- Image and file downloading
- CSV / JSON export
- Logging system
Install
pip install httpx beautifulsoup4 playwright
playwright install chromium
Basic Usage
from scraper import Scraper
s = Scraper(url="https://example.com", debug=True)
s.fetch()
print(s.get_text("h1"))
print(s.get_links())
Common Examples
Fetch a page
s.fetch("https://example.com")
Force JS rendering
s.fetch("https://site.com", use_browser=True)
# or
s.render_js()
Extract text
s.get_text(".title")
s.get_text_clean(".content")
Get links & images
s.get_links()
s.get_images()
Extract tables
table = s.get_table()
Scrape paginated pages
s.scrape_pages("https://site.com/page/{}", 5, ".item")
Auto "Next" pagination
s.scrape_auto_next("https://site.com", ".post")
Parallel fetch
urls = ["https://a.com", "https://b.com"]
s.fetch_multiple(urls, workers=5)
JSON API
s.get_json("https://api.site.com/data")
Submit form
s.submit_form("https://site.com/login", {
"user": "name",
"pass": "password"
})
Download files
s.download_file(url, "file.pdf")
s.download_images("images/")
Export
s.export_csv(data, "data.csv")
s.export_json(data, "data.json")
Close resources
s.close()
Notes
- Automatically switches to browser mode if blocked
- Thread‑safe request handling
- Suitable for large scraping jobs
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 ezextract-0.1.1.tar.gz.
File metadata
- Download URL: ezextract-0.1.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1cfd4de3733e6c193b33e6601d50da492fe0b401e0510775229253ceeea7cf2
|
|
| MD5 |
abfc385dac814ff24328815cc30d9f15
|
|
| BLAKE2b-256 |
a24ee567656b73d5aa167d4b2eff37a4c6b39ba3752e03ac8dc7da4bacd8e21b
|
File details
Details for the file ezextract-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ezextract-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7420d77b0d2984d5ad992d07182be52695ffc3d12300199dc0410dd98cd41332
|
|
| MD5 |
730885c4afa370ad4e8663b317b4dffb
|
|
| BLAKE2b-256 |
9b8a1b9ffee8bd003e12794886ebcad77e84ceb4ef4bf1ffa8c13f27f81a60f7
|