File size: 1,369 Bytes
1f8acec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
from pathlib import Path


class Config:
    """Application Configuration"""
    
    # Base directories
    BASE_DIR = Path(__file__).parent.parent.parent.parent
    OUTPUT_DIR = BASE_DIR / 'output'
    SCREENSHOTS_DIR = OUTPUT_DIR / 'screenshots'
    
    # Data files
    DATA_FILE = OUTPUT_DIR / 'data.jsonl'
    
    # Parser settings
    TIMEOUT_MS = 60000
    SCROLL_DELAY = 2000
    MAX_NO_CHANGE_COUNT = 3
    
    # User Agents
    USER_AGENTS = [
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
    ]
    
    # Screenshot settings
    SCREENSHOT_VIEWPORT = {'width': 1920, 'height': 1080}
    SCREENSHOT_WAIT_TIME = 3000
    
    # Cloudflare bypass
    CLOUDFLARE_WAIT_TIME = 5000
    CLOUDFLARE_INDICATORS = [
        "Verify you are human",
        "Checking your browser before accessing",
        "Just a moment..."
    ]
    
    def __init__(self):
        # Create necessary directories
        self.OUTPUT_DIR.mkdir(exist_ok=True)
        self.SCREENSHOTS_DIR.mkdir(exist_ok=True)