Universal web DOM scraper for Python. Fetch any page, query with CSS/XPath, full-text search, filter, extract structured data, export to JSON/CSV/SQLite. Auto-detects SPAs and switches to Playwright when needed.
Features
Auto-detection — static pages use requests, JS-rendered SPAs automatically switch to Playwright
Fluent API — chain .fetch().query().where().extract().export() in one line
CSS / XPath / Regex selectors — query the DOM however you want
Full-text search — find any word anywhere on the page
from supescrapper import Scraper
# Get all headings from a page
results = Scraper().fetch("https://example.com").query("h1").extract()
for item in results:
print(item.text)
Python API
Basic Fetching
from supescrapper import Scraper
# Fetch any URL — auto-detects if it needs Playwright
results = Scraper().fetch("https://example.com").query("h1").extract()
# Force static only (requests, no browser)
results = Scraper().fetch("https://example.com", dynamic=False).query("h1").extract()
# Force Playwright (for SPAs)
results = Scraper().fetch("https://myapp.com", dynamic=True).query(".card").extract()
# Find all elements whose text matches a regex pattern
results = Scraper().fetch("https://example.com").query(r"\$\d+\.\d{2}", mode="regex").extract()
Full-Text Search
# Find every element on the page containing the word "price"
results = Scraper().fetch("https://example.com").search("price").extract()
# Case-sensitive search
results = Scraper().fetch("https://example.com").search("JavaScript", case_sensitive=True).extract()
# Extract structured data from each matched element
results = (
Scraper()
.fetch("https://example.com/products")
.query(".product-card")
.extract(
name="h2.text",
price="span.price.text",
link="a@href",
image="img@src",
)
)
for item in results:
print(item["name"], item["price"], item["link"])
Extract Links and Images
# All links on a page
links = Scraper().fetch("https://example.com").extract_links()
for link in links:
print(link.text, "->", link.url)
# All images
images = Scraper().fetch("https://example.com").extract_images()
for img in images:
print(img.attrs.get("src"))
from supescrapper import Scraper
html = open("page.html").read()
results = Scraper().from_html(html).query("h1").extract()
Working with Results
results = Scraper().fetch("https://example.com").query("a").extract()
# Iteratefor item in results:
print(item.tag, item.text, item.url, item.attrs)
# Access by index
first = results[0]
last = results[-1]
# Get first/last
first = results.first()
last = results.last()
# Lengthprint(len(results))
# Convert to list of dicts
data = results.to_list()
# Convert to JSON string
json_str = results.to_json(indent=2)
# Get dict from a single item
item = results[0]
d = item.to_dict() # {'tag': 'a', 'text': 'Click here', 'href': '/page'}
Exporting
results = Scraper().fetch("https://example.com").query("a").extract()
# Export to JSON
results.export("json", "links.json")
# Export to CSV
results.export("csv", "links.csv")
# Export to SQLite
results.export("sqlite", "links.db", table="links")
# Auto-detect (default behavior)
supescrapper https://myapp.com --select".card" --table
# Force Playwright
supescrapper https://myapp.com --select".card" --dynamic --table
# Force static only
supescrapper https://example.com --select"h1" --static --table
Full CLI Reference
supescrapper --help
positional arguments:
url URL to scrape
options:
--select, -s CSS selector
--select-xpath XPath selector
--select-regex Regex to match element text
--search Full-text search for a term
--extract, -e Named fields, e.g. title="h2.text"
--dynamic, -d Force Playwright
--static Force static requests only
--where-text OP VALUE Filter: "contains|equals|matches" value
--where-attr ATTR OP VALUE Filter by attribute
--where-tag TAG Filter by tag name
--limit, -n N Limit results
--export {json,csv,sqlite} Export format
--output, -o PATH Output file path
--table Print as terminal table
--raw Print raw JSON
--extract-links Extract all links
--extract-images Extract all images
--extract-table Extract HTML table