|
|
hai 8 meses | |
|---|---|---|
| data | hai 8 meses | |
| docs | hai 8 meses | |
| scripts | hai 8 meses | |
| src | hai 8 meses | |
| web | hai 8 meses | |
| .env.example | hai 8 meses | |
| .gitignore | hai 8 meses | |
| .mcp-gogs.json | hai 8 meses | |
| CLAUDE.md | hai 8 meses | |
| README.md | hai 8 meses | |
| package-lock.json | hai 8 meses | |
| package.json | hai 8 meses | |
| tsconfig.json | hai 8 meses |
A TypeScript-based web scraper for extracting information from webshops with persistent storage, scheduled scraping, and change detection.
Clone and install:
git clone <repository-url>
cd webshop-scraper
npm install
Build:
npm run build
Configure environment:
# Basic Configuration
API_KEY=your-secret-key
PORT=3000
MAX_CONCURRENT_JOBS=3
# Logging (Optional)
LOG_HTTP_VERBOSE=true # Enable detailed HTTP logs with User-Agent and content-length
# Qdrant Vector Search (Optional)
QDRANT_API_URL=http://localhost:6333
QDRANT_API_KEY=your-qdrant-key
# OpenRouter for Embeddings (Optional)
OPENROUTER_API_KEY=your-openrouter-key
OPENROUTER_MODEL=openai/text-embedding-3-large
# MCP Integration (Optional)
MCP_ENABLED=true
MCP_TRANSPORT=stdio
Start:
npm start
sudo ./scripts/install.sh
Reset the system to a clean state (creates backup first):
sudo ./scripts/reset.sh
Restore from a previous backup:
sudo ./scripts/restore.sh
What gets backed up:
Backups are stored in /var/backups/webshop-scraper/ with timestamps.
The system includes optional Qdrant vector search capabilities for semantic search of scraped content:
search_shipping_info(shop_id, query, limit?) - Search shipping and delivery informationsearch_contact_info(shop_id, query, limit?) - Search contact and support informationsearch_terms_info(shop_id, query, limit?) - Search terms of service and policiessearch_faq_info(shop_id, query, limit?) - Search frequently asked questionsSee the Qdrant Setup Guide for complete configuration instructions.
See API Documentation for complete endpoint reference. See Qdrant API Reference for vector search endpoints.
Create a scraping job:
curl -X POST http://localhost:3000/api/jobs \
-H "Authorization: Bearer your-secret-key" \
-H "Content-Type: application/json" \
-d '{"url": "https://example-shop.com"}'
Get shop information:
curl http://localhost:3000/api/shops/:id \
-H "Authorization: Bearer your-secret-key"
Get shop results:
curl "http://localhost:3000/api/shops/:id/results?limit=10" \
-H "Authorization: Bearer your-secret-key"
# Development mode
npm run dev
# Watch mode
npm run watch
# Build
npm run build
Data is stored in data/shops.db (SQLite). The database includes:
The system includes enhanced HTTP access logging with status codes, response times, and optional verbose mode.
Standard HTTP logs:
[INFO] [WebshopScraper] ✓ 200 GET /api/shops ::1 45ms
[INFO] [WebshopScraper] ⚠️ 404 GET /api/shops/invalid ::1 12ms
[INFO] [WebshopScraper] ❌ 500 POST /api/jobs ::1 234ms
Verbose HTTP logs (with LOG_HTTP_VERBOSE=true):
[INFO] [WebshopScraper] ✓ 200 GET /api/shops ::1 45ms 2456b UA:"curl/7.81.0"
Using journalctl (systemd):
# Follow logs in real-time
sudo journalctl -u webshop-scraper -f
# View logs with timestamps
sudo journalctl -u webshop-scraper --no-pager
# Filter by priority
sudo journalctl -u webshop-scraper -p err # Only errors
Using npm (development):
npm run dev # Includes timestamps in output
ISC