LovnishVerma commited on
Commit
c9210a4
Β·
verified Β·
1 Parent(s): 50dca14

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +138 -1
README.md CHANGED
@@ -7,4 +7,141 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  pinned: false
8
  ---
9
 
10
+ # πŸ•·οΈ WebScraper.pro β€” Premium Web Scraping Platform
11
+
12
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
13
+ [![Flask Version](https://img.shields.io/badge/flask-3.0.3-green.svg)](https://flask.palletsprojects.com/)
14
+ [![Playwright](https://img.shields.io/badge/playwright-1.44.0-orange.svg)](https://playwright.dev/python/)
15
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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
+