<# .SYNOPSIS BTGO Scraper - Rulare Development .DESCRIPTION Ruleaza scraper-ul BTGO in modul development (cu browser vizibil) .NOTES Echivalent PowerShell pentru scripts\run_dev.bat Rulare: Right-click → "Run with PowerShell" #> $ErrorActionPreference = "Stop" $ScriptDir = Split-Path -Parent $PSCommandPath $ProjectDir = Resolve-Path (Join-Path $ScriptDir "..\..\..") | Select-Object -ExpandProperty Path Set-Location $ProjectDir Write-Host "" Write-Host ("=" * 80) -ForegroundColor Cyan Write-Host " BTGO SCRAPER - RULARE DEVELOPMENT" -ForegroundColor Yellow Write-Host ("=" * 80) -ForegroundColor Cyan Write-Host "" Write-Host "Working directory: $ProjectDir" -ForegroundColor Gray Write-Host "" # Verifică dacă venv există $venvPath = Join-Path $ProjectDir ".venv" $activateScript = Join-Path $venvPath "Scripts\Activate.ps1" if (-not (Test-Path $activateScript)) { Write-Host "[ERROR] Virtual environment nu exista sau este incomplet!" -ForegroundColor Red Write-Host "Ruleaza intai: setup_dev.ps1" -ForegroundColor Yellow Write-Host "" Read-Host "Apasa Enter pentru a inchide" exit 1 } # Activează venv Write-Host "Activare virtual environment..." -ForegroundColor Cyan try { & $activateScript Write-Host "[OK] Virtual environment activat." -ForegroundColor Green Write-Host "" } catch { Write-Host "[ERROR] Nu am putut activa venv!" -ForegroundColor Red Write-Host "Eroare: $_" -ForegroundColor Red Write-Host "" Read-Host "Apasa Enter pentru a inchide" exit 1 } # Verifică dacă .env există $envFile = Join-Path $ProjectDir ".env" $envExample = Join-Path $ProjectDir ".env.example" if (-not (Test-Path $envFile)) { Write-Host "[WARNING] Fisierul .env nu exista!" -ForegroundColor Yellow if (Test-Path $envExample) { Write-Host "Copiez din .env.example..." -ForegroundColor Yellow Copy-Item $envExample $envFile Write-Host "" Write-Host "IMPORTANT: Editeaza .env cu credentialele tale!" -ForegroundColor Yellow Start-Process notepad $envFile -Wait Write-Host "" Read-Host "Apasa Enter dupa ce salvezi .env" } else { Write-Host "[ERROR] .env.example nu exista!" -ForegroundColor Red Write-Host "" Read-Host "Apasa Enter pentru a inchide" exit 1 } } # Verifică directoare output $dataDir = Join-Path $ProjectDir "data" $logsDir = Join-Path $ProjectDir "logs" if (-not (Test-Path $dataDir)) { New-Item -ItemType Directory -Path $dataDir | Out-Null } if (-not (Test-Path $logsDir)) { New-Item -ItemType Directory -Path $logsDir | Out-Null } # Rulează scraper Write-Host "" Write-Host ("=" * 80) -ForegroundColor Cyan Write-Host "Pornire scraper..." -ForegroundColor Yellow Write-Host "Browser-ul va fi vizibil pentru debugging." -ForegroundColor Gray Write-Host ("=" * 80) -ForegroundColor Cyan Write-Host "" try { & python btgo_scraper.py } catch { Write-Host "" Write-Host "[ERROR] Executie esuata: $_" -ForegroundColor Red Write-Host "" Read-Host "Apasa Enter pentru a inchide" exit 1 } Write-Host "" Write-Host ("=" * 80) -ForegroundColor Cyan Write-Host "Executie terminata." -ForegroundColor Green Write-Host "Verifica rezultatele in:" -ForegroundColor Cyan Write-Host " - data\solduri_*.csv" -ForegroundColor Gray Write-Host " - data\tranzactii_*.csv" -ForegroundColor Gray Write-Host " - logs\scraper_*.log" -ForegroundColor Gray Write-Host ("=" * 80) -ForegroundColor Cyan Write-Host "" Read-Host "Apasa Enter pentru a inchide"