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
[](https://www.python.org/)
|
| 13 |
+
[](https://flask.palletsprojects.com/)
|
| 14 |
+
[](https://playwright.dev/python/)
|
| 15 |
+
[](https://opensource.org/licenses/MIT)
|
| 16 |
+
|
| 17 |
+
**WebScraper.pro** is a professional, secure, and production-ready web scraping platform built on Python and Flask. It provides a visual dashboard to configure, manage, and schedule scraping jobs targeting both static pages and modern dynamic (JavaScript-rendered) websites, exporting cleanly to JSON, CSV, or Excel.
|
| 18 |
+
|
| 19 |
+
Designed with a **premium dark-mode visual interface** featuring glassmorphism elements, dynamic micro-animations, and live job status polling.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## π Key Features
|
| 24 |
+
|
| 25 |
+
* **β‘ Dual Scraping Engines:**
|
| 26 |
+
* **Static Engine:** Fast, lightweight HTTP requests combined with BeautifulSoup4 parsing.
|
| 27 |
+
* **Dynamic Engine:** Headless Playwright integration for complex, client-side, JavaScript-heavy SPAs.
|
| 28 |
+
* **π Premium Real-Time Dashboard:**
|
| 29 |
+
* Live-updating analytics cards (success rates, items scraped, running jobs).
|
| 30 |
+
* Auto-refreshing status progress bars and real-time console log stream.
|
| 31 |
+
* **π Granular Visual Extractors:**
|
| 32 |
+
* Select data via **CSS Selectors**, **XPath Expressions**, **HTML Tags**, or **HTML Attributes**.
|
| 33 |
+
* Custom configurations for **Table Data**, **JSON-LD Schema**, and **Full HTML** extractions.
|
| 34 |
+
* **βοΈ Enterprise Crawl Controls:**
|
| 35 |
+
* Auto-rotating random User Agents per request.
|
| 36 |
+
* Adaptive request throttling (custom delays) and automatic retry policies.
|
| 37 |
+
* Infinite scroll triggers (custom scroll depth) and standard pagination crawling.
|
| 38 |
+
* Full support for custom HTTP request headers (JSON format).
|
| 39 |
+
* **π Production-Grade Security:**
|
| 40 |
+
* High-performance request rate limiting powered by `Flask-Limiter`.
|
| 41 |
+
* Industry-standard Cross-Site Request Forgery (`CSRFProtect`) protection.
|
| 42 |
+
* Strict security headers (CSP, X-Frame-Options, X-Content-Type) and sanitize filters (`bleach`).
|
| 43 |
+
* **π₯ Multi-Format Exporters:** Export scraped datasets on-demand to structured **JSON**, **CSV**, or Microsoft **Excel** (`.xlsx`).
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## ποΈ Modular Architecture
|
| 48 |
+
|
| 49 |
+
The platform has been re-architected from a flat layout into a highly maintainable, standardized **Application Factory Blueprint** structure:
|
| 50 |
+
|
| 51 |
+
```
|
| 52 |
+
webscraping/
|
| 53 |
+
βββ app/
|
| 54 |
+
β βββ __init__.py # Application Factory initialization
|
| 55 |
+
β βββ config/ # Settings & Environment configurations
|
| 56 |
+
β βββ models/ # SQLAlchemy ORM schemas (BaseModel, User, ScrapeJob, etc.)
|
| 57 |
+
β βββ scrapers/ # Core Scraping Engine (Static & Playwright)
|
| 58 |
+
β βββ services/ # Job Execution, Excel/CSV Exports, Statistics calculations
|
| 59 |
+
β βββ middleware/ # Rate limiting and Security headers middleware
|
| 60 |
+
β βββ routes/ # Modular controller Blueprints (Main, Jobs)
|
| 61 |
+
β βββ utils/ # Input validation & Logging configurators
|
| 62 |
+
β βββ templates/ # HTML templates (dashboard, job details, forms)
|
| 63 |
+
β βββ static/ # Premium custom CSS, JS assets
|
| 64 |
+
βββ run.py # Production-ready entry point
|
| 65 |
+
βββ .env # Environment secrets
|
| 66 |
+
βββ requirements.txt # Package dependencies
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## π Quick Start
|
| 72 |
+
|
| 73 |
+
### π Prerequisites
|
| 74 |
+
- Python **3.10** or higher
|
| 75 |
+
- Node.js (required for Playwright browsers dependency)
|
| 76 |
+
|
| 77 |
+
### 1. Clone & Set Up Directory
|
| 78 |
+
```bash
|
| 79 |
+
git clone https://github.com/your-username/webscraper-pro.git
|
| 80 |
+
cd webscraper-pro
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
### 2. Configure Virtual Environment
|
| 84 |
+
```bash
|
| 85 |
+
python -m venv venv
|
| 86 |
+
# On Windows (PowerShell)
|
| 87 |
+
.\venv\Scripts\Activate.ps1
|
| 88 |
+
# On macOS/Linux
|
| 89 |
+
source venv/bin/activate
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
### 3. Install Dependencies
|
| 93 |
+
```bash
|
| 94 |
+
pip install -r requirements.txt
|
| 95 |
+
playwright install chromium
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### 4. Setup Environment Variables
|
| 99 |
+
Create a `.env` file in the root directory. You can copy the example file:
|
| 100 |
+
```bash
|
| 101 |
+
cp env.example .env
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
Open `.env` and set up your application environment details:
|
| 105 |
+
```ini
|
| 106 |
+
# Core
|
| 107 |
+
FLASK_APP=app
|
| 108 |
+
FLASK_ENV=development
|
| 109 |
+
SECRET_KEY=generate-a-strong-random-key-here
|
| 110 |
+
DEBUG=True
|
| 111 |
+
|
| 112 |
+
# Database (Leave commented out to use default SQLite)
|
| 113 |
+
# DATABASE_URL=sqlite:///database/scraper.db
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
### 5. Launch the Server
|
| 117 |
+
```bash
|
| 118 |
+
python run.py
|
| 119 |
+
```
|
| 120 |
+
The application will start, seed database configurations automatically, and be accessible at **`http://127.0.0.1:5000`**.
|
| 121 |
+
|
| 122 |
+
---
|
| 123 |
+
|
| 124 |
+
## π οΈ Configuration Settings (`.env`)
|
| 125 |
+
|
| 126 |
+
| Variable | Type | Default | Description |
|
| 127 |
+
|----------|------|---------|-------------|
|
| 128 |
+
| `FLASK_ENV` | String | `production` | Environment type (`development` or `production`) |
|
| 129 |
+
| `SECRET_KEY` | String | *Required* | Secret key for session encryption & CSRF tokens |
|
| 130 |
+
| `DEBUG` | Boolean | `False` | Enables or disables interactive debug tools |
|
| 131 |
+
| `DATABASE_URL` | String | `sqlite:///database/scraper.db` | Target database connection URI |
|
| 132 |
+
| `RATELIMIT_DEFAULT` | String | `100 per minute` | Default global API rate limit constraint |
|
| 133 |
+
|
| 134 |
+
---
|
| 135 |
+
|
| 136 |
+
## π Security Compliance
|
| 137 |
+
|
| 138 |
+
This platform enforces secure engineering best practices:
|
| 139 |
+
- **Input Sanitization:** Uses `bleach` and custom content validators to strip dangerous Javascript/HTML injection payloads before database commit.
|
| 140 |
+
- **Robust Rate-Limiting:** Defends against scraping-abuse/DoS using local in-memory window limitation schemas.
|
| 141 |
+
- **Strict Headers:** Employs security middleware to restrict frame injection, content sniffing, and force standard CORS controls.
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
+
|
| 145 |
+
## π License
|
| 146 |
+
Distributed under the MIT License. See [LICENSE](LICENSE) for more details.
|
| 147 |
+
|