|
|
|
|
graph LR
A[Web UI] --> B[Flask API]
B --> C[Selenium Engine]
C --> D[ProxyMesh]
D --> E[Twitter]
C --> F[MongoDB]
B --> F
# System Requirements
✓ Python 3.8+
✓ MongoDB 5.0+
✓ Chrome/Chromium
✓ Twitter Account
✓ ProxyMesh Account
# Clone repository
git clone https://github.com/alphamoris/Web-Scraper.git
cd twitter-trends-scraper
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/macOS
.\venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
Create a .env
file in the root directory:
# Required Environment Variables
MONGO_URI=mongodb://localhost:27017/
TWITTER_USERNAME=your_username
TWITTER_PASSWORD=your_password
PROXYMESH_USERNAME=your_proxymesh_username
PROXYMESH_PASSWORD=your_proxymesh_password
# Start the application
python app.py
# Access the dashboard at http://localhost:5000
options = {
'headless': True, # Run in background
'proxy_rotation': True, # Enable IP rotation
'retry_attempts': 3, # Failed request retries
'timeout': 30, # Request timeout (seconds)
'user_agent_rotation': True # Browser fingerprint protection
}
{
"_id": "uuid-v4",
"timestamp": ISODate("2024-12-25T17:08:30.123Z"),
"metadata": {
"ip_address": "xxx.xxx.xxx.xxx",
"proxy_region": "us-east",
"execution_time": 1.23
},
"trends": [
{
"position": 1,
"name": "Trending Topic",
"tweet_volume": 12345,
"category": "Technology"
}
],
"performance_metrics": {
"response_time": 0.45,
"processing_time": 0.78
}
}
Metric | Value |
---|---|
Average Response Time | < 2s |
Success Rate | 99.9% |
Data Accuracy | 99.99% |
Concurrent Users | 1000+ |
LOGGING = {
'version': 1,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'level': 'INFO'
},
'file': {
'class': 'logging.FileHandler',
'filename': 'app.log',
'level': 'DEBUG'
}
}
}
# Run tests
pytest tests/
# Code formatting
black .
flake8 .
# Type checking
mypy .
We welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Special thanks to:
- Twitter - Platform & API
- ProxyMesh - Enterprise proxy solutions
- MongoDB - Database infrastructure
- Selenium - Web automation
- Flask - Web framework
Created with ❤️ by Alpha