ScrapeSome
ScrapeSome is a lightweight, flexible web scraping library with both synchronous and asynchronous support. It includes intelligent fallbacks, JavaScript page rendering, response formatting (HTML → Text/JSON/Markdown), and retry mechanisms. Ideal for developers who need robust scraping utilities with minimal setup.
Table of Contents
- 💡 Why Use ScrapeSome?
- 🚀 Features
- ⚖ Comparison with Alternatives
- 📦 Installation
- Playwright Setup
- ⚡ Quick Start
- 🖥️ CLI Usage
- 🧰 Advanced Usage
- 🧪 Testing
- ⚙️ Environment Configuration
- 📄 Output Formats
- 📁 Project Structure
- 🔒 License
- 🤝 Contributions
💡 Why Use ScrapeSome?
- Handles both static and JS-heavy pages out of the box
- Supports both sync and async scraping
- Converts raw HTML into clean text, JSON, or Markdown
- Works with minimal configuration (
pip install scrapesome) - Handles timeouts, retries, redirects, user agents
🚀 Features
- 🔁 Sync + Async scraping support
- 🔄 Automatic retries and intelligent fallbacks
- 🧪 Playwright rendering fallback for JS-heavy pages
- 📝 Format responses as raw HTML, plain text, Markdown, or structured JSON
- ⚙️ Configurable: timeouts, redirects, user agents, and logging
- 🧪 Test coverage with
pytestandpytest-asyncio
⚖ Comparison with Alternatives
| Feature | ScrapeSome ✅ | Playwright (Python) | Selenium + UC | Requests-HTML | Scrapy + Playwright |
|---|---|---|---|---|---|
| 🧠 JS Rendering Support | ✅ Auto fallback on 403/JS content | ✅ Always (manual control) | ✅ Always (manual control) | ✅ Partial (via Pyppeteer) | ✅ Requires setup |
| 🔄 Automatic Fallback (403/Blank) | ✅ Yes (seamless) | ❌ Manual logic needed | ❌ Manual logic needed | ❌ No | ❌ Needs per-request config |
| 🔁 Uses Browser Engine | ✅ Only when needed (Playwright) | ✅ Always | ✅ Always | ✅ (Unstable, slow) | ✅ Always (if enabled) |
| ✅ Sync + Async Support | ✅ Built-in | ❌ Async only | ❌ Manual (via threading) | ❌ Sync only | ❌ Async only (via plugin) |
| 📝 JSON/Markdown/HTML Output | ✅ Built-in formats | ❌ Manual parsing | ❌ Manual parsing | ❌ Basic only | ❌ Custom pipeline needed |
| ⚡ Minimal Setup | ✅ Near zero | ❌ Code + browser install | ❌ Driver + setup | ✅ Simple pip install | ❌ Complex + plugin setup |
| 🔁 Retries, Timeouts, Agents | ✅ Smart defaults built-in | ❌ Manual handling | ❌ Manual handling | ❌ Limited | ⚠️ Partial via settings |
| 🧪 Pytest-Ready Out-of-the-box | ✅ Fully testable | ⚠️ Requires mocks | ❌ Hard to test | ❌ Minimal | ⚠️ Needs testing harness |
| ⚙️ Config via .env / Inline | ✅ Flexible and optional | ❌ Code/config only | ❌ Manual via code | ❌ Hardcoded mostly | ⚠️ Project settings |
| 📦 Install & Run in <1 Min | ✅ Yes | ❌ Setup required | ❌ Driver + config needed | ✅ Yes | ❌ Needs project + plugin |
📦 Installation
pip install scrapesome
Playwright Setup
ScrapeSome uses Playwright for JavaScript rendering fallback. To enable this, you need to install Playwright and its dependencies.
1. Install Playwright Python package if not installed
pip install playwright
2. Install Playwright browsers
playwright install
3. Install system dependencies
Playwright requires some system libraries to run browsers, which vary by operating system.
For Windows Playwright installs everything you need automatically with playwright install, so no additional setup is usually required.
For Linux (Ubuntu/Debian) Run the following command to install required system libraries:
playwright install-deps
If you don't have playwright CLI available, you can install dependencies manually:
sudo apt-get update
sudo apt-get install -y libwoff1 libopus0 libwebp6 libharfbuzz-icu0 libwebpmux3 \
libenchant-2-2 libhyphen0 libegl1 libglx0 libgudev-1.0-0 \
libevdev2 libgles2 libx264-160
Note: Package names may vary depending on your distribution and version.
For macOS You can install required libraries using Homebrew:
brew install harfbuzz enchant
After this setup, you should be able to use ScrapeSome with full Playwright rendering support!
⚡ Quick Start
Synchronous Example
from scrapesome import sync_scraper
html = sync_scraper("https://example.com")
html
Asynchronous Example
import asyncio
from scrapesome import async_scraper
html = asyncio.run(async_scraper("https://example.com"))
html
🖥️ CLI Usage
ScrapeSome also includes a powerful CLI for quick and easy scraping from the command line.
📦 Installation with CLI Support
To use the CLI, install with the optional cli extras:
pip install scrapesome[cli]
🔧 Basic Usage
scrapesome scrape --url https://example.com
This performs a synchronous scrape and outputs plain text by default.
⚙️ Available Options
| Option | Description | Default |
|---|---|---|
--async-mode |
Use asynchronous scraping | False |
--force-playwright |
Force JavaScript rendering using Playwright | False |
--output-format |
Choose text, json, markdown, or html |
html |
Examples
Basic scrape
scrapesome scrape --url https://example.com
Force Playwright rendering
scrapesome scrape --url https://example.com --force-playwright
Get JSON output
scrapesome scrape --url https://example.com --output-format json
Async scrape with markdown output
scrapesome scrape --url https://example.com --async-mode --output-format markdown
📄 File Saving
ScrapeSome allows you to format and save your scraped content with zero hassle—both via the CLI and in Python code.
💻 Save Output to File
Use these flags to save your output directly from the command line:
--save-to-fileor-s: Enable saving to a file--file-nameor-n: Desired filename (extension added automatically)--output-formator-f: One ofhtml,text,markdown, orjson
⚠️ Note: When saving to a file, only one URL can be scraped at a time.
📦 Example:
scrapesome scrape --url "https://example.com" --output-format markdown --save-to-file --file-name output
👉 This saves the result as output.md.
Save Output in Code
The sync_scraper function supports saving to file using two optional flags:
save_to_file=True: Enables savingfile_name="your_file_name": Sets the base filename (extension inferred from format)
The output will be returned as a dictionary:
{
"data": "<formatted content>",
"file": "your_file_name.<ext>" # if saving is enabled
}
📌 Example:
result = sync_scraper(url="https://example.com", output_format_type="json", save_to_file=True, file_name="example_output")
print(f"Saved output to {result.get('file')}")
Now you're set to save clean, readable data in your preferred format—programmatically or from the CLI.
🧰 Advanced Usage
Force Rendering (Playwright)
from scrapesome import sync_scraper
content = sync_scraper("https://example.com", force_playwright=True)
content
Custom User Agents
from scrapesome import sync_scraper
content = sync_scraper("https://example.com", user_agents=["MyCustomAgent/1.0"])
content
Control Redirects
from scrapesome import sync_scraper
content = sync_scraper("https://example.com", allow_redirects=False)
content
similarly async_scraper can also be used.
🧪 Testing
Run tests with:
pytest --cov=scrapesome tests/
Target coverage: 75–100%
⚙️ Environment Configuration
ScrapeSome reads from environment variables if a .env file is present.
Example .env
LOG_LEVEL=INFO
OUTPUT_FORMAT=text
FETCH_PLAYWRIGHT_TIMEOUT=10
FETCH_PAGE_TIMEOUT=10
USER_AGENTS=["Mozilla/5.0 (Windows NT 10.0; Win64; x64)......."]
| Key | Description |
|---|---|
| FETCH_PLAYWRIGHT_TIMEOUT | Timeout for Playwright-rendered pages (in seconds) |
| FETCH_PAGE_TIMEOUT | Timeout for standard page fetch (in seconds) |
| LOG_LEVEL | Logging verbosity (DEBUG, INFO, WARNING, etc.) |
| OUTPUT_FORMAT | Default output format (text, markdown, json, html) |
| USER_AGENTS | Default user agents ("Mozilla/5.0 (Windows NT 10.0; Win64; x64).......") |
📄 Output Formats
JSON Example
Get json version
from scrapesome import sync_scraper
content = sync_scraper("https://example.com", output_format_type="json")
content
Output
{
"title": "Example Domain",
"description": "This domain is for use in illustrative examples.",
"url": "https://example.com"
}
Markdown
Convert HTML to Markdown with:
from scrapesome import sync_scraper
content = sync_scraper("https://adenuniversity.us", output_format_type="markdown")
content
Output
# Online Global Masters that boost your global career
**ADEN University** offers students access to professionals who operate in the world of business and administration, who share their knowledge and acumen collaboratively with their students in all **academic programs** offered at ADEN.
[About Us](about-aden-university)
Watch testimonial video
##### Watch testimonial video
×
[
](https://res.cloudinary.com/cruminott/video/upload/vc_auto,w_auto,q_auto,f_auto/adenu/aden-university-3.mp4)
## ADEN University offers the following academic programs
[](https://adenuniversity.us/academics/executive-mba/ "EXECUTIVE MBA. Master of Business Administration")
##### [EXECUTIVE MBA. Master of Business Administration](https://adenuniversity.us/academics/executive-mba/ "EXECUTIVE MBA. Master of Business Administration")
The ADEN University Executive MBA is designed to strengthen business leaders to manage...
* **37** credits
* **15** months
* **Spanish Only**
[Visit EMBA Course](https://adenuniversity.us/academics/executive-mba/ "EXECUTIVE MBA. Master of Business Administration")
[](https://adenuniversity.us/academics/global-mba/ "GLOBAL MBA. Master of Business Administration")
##### [GLOBAL MBA. Master of Business Administration](https://adenuniversity.us/academics/global-mba/ "GLOBAL MBA. Master of Business Administration")
The Global MBA is designed to prepare business leaders to manage companies in an...
* **36** credits
* **14** months
* **Spanish and English**
similarly async_scraper can also be used.
📁 Project Structure
scrapesome/
├── .gitignore
├── pytest.ini
├── mkdocs.yml
├── .github/
│ ├── workflows/
│ │ └── deploy.yml
│ ├── ISSUE_TEMPLATE/
│ │ └── index.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── CODE_OF_CONDUCT.md
│ └── SECURITY.md
├── __init__.py
├── cli.py
├── config.py
├── exceptions.py
├── formatter/
│ ├── __init__.py
│ └── output_formatter.py
├── logging.py
├── scraper/
│ ├── __init__.py
│ ├── async_scraper.py
│ ├── sync_scraper.py
│ └── rendering.py
├── utils/
│ ├── __init__.py
│ ├── fetch_visible_content.py
│ └── file_writer.py
├── docs/
│ ├── index.md
│ ├── getting_started.md
│ ├── usage.md
│ ├── config.md
│ ├── examples.md
│ ├── cli.md
│ ├── about.md
│ ├── licence.md
│ ├── file-saving.md
│ ├── contribution.md
│ ├── output-formats.md
│ └── assets/
│ └── images/
│ └── favicon.png
├── tests/
│ ├── __init__.py
│ ├── test_sync_scraper.py
│ ├── test_async_scraper.py
│ ├── test_config.py
│ ├── test_logging.py
│ ├── test_rendering.py
│ ├── test_file_writer.py
│ ├── test_fetch_visible_content.py
│ ├── test_output_formatter.py
│ └── test_cli.py
├── setup.py
├── requirements.txt
├── pyproject.toml
├── LICENSE
└── README.md
🔒 License
MIT License © 2025
🤝 Contributions
Contributions are welcome! Whether it's bug reports, feature suggestions, or pull requests — your help is appreciated.
To get started:
git clone https://github.com/scrapesome/scrapesome.git
cd scrapesome
Community
Metadata
Release files for scrapesome 0.1.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 | Actions |
|---|---|---|---|---|
| scrapesome-0.1.5.tar.gz | 31.0 kB | Without provenance | Details for scrapesome-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapesome-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for scrapesome-0.1.5-py3-none-any.whl |
Total release size: 53.9 kB
Release files / scrapesome-0.1.5.tar.gz
| Download URL | scrapesome-0.1.5.tar.gz |
|---|---|
| Size | 31.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4dfd2dd6b75df37053921bd98c4aa1b53a50a4ad63230f8ff69925f93ecdb7e1
|
|
BLAKE2b-256 checksum How to use checksums |
628e2022f394d48e4172936736789f784b76175f65878f35e8d4f885dd2a036a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / scrapesome-0.1.5-py3-none-any.whl
| Download URL | scrapesome-0.1.5-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af0908f0e542804fbeb6aee0c1c83997131aeca38109f1ddefdbf286669f5f42
|
|
BLAKE2b-256 checksum How to use checksums |
7be7eaa6946c2f2d348dae7bef2fc26375c42588df8c87b666a74325ca6548a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for scrapesome 0.1.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.