unrealon 1.0.9__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unrealon/__init__.py +23 -21
- unrealon-1.1.0.dist-info/METADATA +164 -0
- unrealon-1.1.0.dist-info/RECORD +82 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.0.dist-info}/WHEEL +1 -1
- unrealon-1.1.0.dist-info/entry_points.txt +9 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.0.dist-info/licenses}/LICENSE +1 -1
- unrealon_bridge/__init__.py +114 -0
- unrealon_bridge/cli.py +316 -0
- unrealon_bridge/client/__init__.py +93 -0
- unrealon_bridge/client/base.py +78 -0
- unrealon_bridge/client/commands.py +89 -0
- unrealon_bridge/client/connection.py +90 -0
- unrealon_bridge/client/events.py +65 -0
- unrealon_bridge/client/health.py +38 -0
- unrealon_bridge/client/html_parser.py +146 -0
- unrealon_bridge/client/logging.py +139 -0
- unrealon_bridge/client/proxy.py +70 -0
- unrealon_bridge/client/scheduler.py +450 -0
- unrealon_bridge/client/session.py +70 -0
- unrealon_bridge/configs/__init__.py +14 -0
- unrealon_bridge/configs/bridge_config.py +212 -0
- unrealon_bridge/configs/bridge_config.yaml +39 -0
- unrealon_bridge/models/__init__.py +138 -0
- unrealon_bridge/models/base.py +28 -0
- unrealon_bridge/models/command.py +41 -0
- unrealon_bridge/models/events.py +40 -0
- unrealon_bridge/models/html_parser.py +79 -0
- unrealon_bridge/models/logging.py +55 -0
- unrealon_bridge/models/parser.py +63 -0
- unrealon_bridge/models/proxy.py +41 -0
- unrealon_bridge/models/requests.py +95 -0
- unrealon_bridge/models/responses.py +88 -0
- unrealon_bridge/models/scheduler.py +592 -0
- unrealon_bridge/models/session.py +28 -0
- unrealon_bridge/server/__init__.py +91 -0
- unrealon_bridge/server/base.py +171 -0
- unrealon_bridge/server/handlers/__init__.py +23 -0
- unrealon_bridge/server/handlers/command.py +110 -0
- unrealon_bridge/server/handlers/html_parser.py +139 -0
- unrealon_bridge/server/handlers/logging.py +95 -0
- unrealon_bridge/server/handlers/parser.py +95 -0
- unrealon_bridge/server/handlers/proxy.py +75 -0
- unrealon_bridge/server/handlers/scheduler.py +545 -0
- unrealon_bridge/server/handlers/session.py +66 -0
- unrealon_browser/__init__.py +61 -18
- unrealon_browser/{src/cli → cli}/browser_cli.py +6 -13
- unrealon_browser/{src/cli → cli}/cookies_cli.py +5 -1
- unrealon_browser/{src/core → core}/browser_manager.py +2 -2
- unrealon_browser/{src/managers → managers}/captcha.py +1 -1
- unrealon_browser/{src/managers → managers}/cookies.py +1 -1
- unrealon_browser/managers/logger_bridge.py +231 -0
- unrealon_browser/{src/managers → managers}/profile.py +1 -1
- unrealon_driver/__init__.py +73 -19
- unrealon_driver/browser/__init__.py +8 -0
- unrealon_driver/browser/config.py +74 -0
- unrealon_driver/browser/manager.py +416 -0
- unrealon_driver/exceptions.py +28 -0
- unrealon_driver/parser/__init__.py +55 -0
- unrealon_driver/parser/cli_manager.py +141 -0
- unrealon_driver/parser/daemon_manager.py +227 -0
- unrealon_driver/parser/managers/__init__.py +46 -0
- unrealon_driver/parser/managers/browser.py +51 -0
- unrealon_driver/parser/managers/config.py +281 -0
- unrealon_driver/parser/managers/error.py +412 -0
- unrealon_driver/parser/managers/html.py +732 -0
- unrealon_driver/parser/managers/logging.py +609 -0
- unrealon_driver/parser/managers/result.py +321 -0
- unrealon_driver/parser/parser_manager.py +628 -0
- unrealon/sdk_config.py +0 -88
- unrealon-1.0.9.dist-info/METADATA +0 -810
- unrealon-1.0.9.dist-info/RECORD +0 -246
- unrealon_browser/pyproject.toml +0 -182
- unrealon_browser/src/__init__.py +0 -62
- unrealon_browser/src/managers/logger_bridge.py +0 -395
- unrealon_driver/README.md +0 -204
- unrealon_driver/pyproject.toml +0 -187
- unrealon_driver/src/__init__.py +0 -90
- unrealon_driver/src/cli/__init__.py +0 -10
- unrealon_driver/src/cli/main.py +0 -66
- unrealon_driver/src/cli/simple.py +0 -510
- unrealon_driver/src/config/__init__.py +0 -11
- unrealon_driver/src/config/auto_config.py +0 -478
- unrealon_driver/src/core/__init__.py +0 -18
- unrealon_driver/src/core/exceptions.py +0 -289
- unrealon_driver/src/core/parser.py +0 -638
- unrealon_driver/src/dto/__init__.py +0 -66
- unrealon_driver/src/dto/cli.py +0 -119
- unrealon_driver/src/dto/config.py +0 -18
- unrealon_driver/src/dto/events.py +0 -237
- unrealon_driver/src/dto/execution.py +0 -313
- unrealon_driver/src/dto/services.py +0 -311
- unrealon_driver/src/execution/__init__.py +0 -23
- unrealon_driver/src/execution/daemon_mode.py +0 -317
- unrealon_driver/src/execution/interactive_mode.py +0 -88
- unrealon_driver/src/execution/modes.py +0 -45
- unrealon_driver/src/execution/scheduled_mode.py +0 -209
- unrealon_driver/src/execution/test_mode.py +0 -250
- unrealon_driver/src/logging/__init__.py +0 -24
- unrealon_driver/src/logging/driver_logger.py +0 -512
- unrealon_driver/src/services/__init__.py +0 -24
- unrealon_driver/src/services/browser_service.py +0 -726
- unrealon_driver/src/services/llm/__init__.py +0 -15
- unrealon_driver/src/services/llm/browser_llm_service.py +0 -363
- unrealon_driver/src/services/llm/llm.py +0 -195
- unrealon_driver/src/services/logger_service.py +0 -232
- unrealon_driver/src/services/metrics_service.py +0 -185
- unrealon_driver/src/services/scheduler_service.py +0 -489
- unrealon_driver/src/services/websocket_service.py +0 -362
- unrealon_driver/src/utils/__init__.py +0 -16
- unrealon_driver/src/utils/service_factory.py +0 -317
- unrealon_driver/src/utils/time_formatter.py +0 -338
- unrealon_llm/README.md +0 -44
- unrealon_llm/__init__.py +0 -26
- unrealon_llm/pyproject.toml +0 -154
- unrealon_llm/src/__init__.py +0 -228
- unrealon_llm/src/cli/__init__.py +0 -0
- unrealon_llm/src/core/__init__.py +0 -11
- unrealon_llm/src/core/smart_client.py +0 -438
- unrealon_llm/src/dto/__init__.py +0 -155
- unrealon_llm/src/dto/models/__init__.py +0 -0
- unrealon_llm/src/dto/models/config.py +0 -343
- unrealon_llm/src/dto/models/core.py +0 -328
- unrealon_llm/src/dto/models/enums.py +0 -123
- unrealon_llm/src/dto/models/html_analysis.py +0 -345
- unrealon_llm/src/dto/models/statistics.py +0 -473
- unrealon_llm/src/dto/models/translation.py +0 -383
- unrealon_llm/src/dto/models/type_conversion.py +0 -462
- unrealon_llm/src/dto/schemas/__init__.py +0 -0
- unrealon_llm/src/exceptions.py +0 -392
- unrealon_llm/src/llm_config/__init__.py +0 -20
- unrealon_llm/src/llm_config/logging_config.py +0 -178
- unrealon_llm/src/llm_logging/__init__.py +0 -42
- unrealon_llm/src/llm_logging/llm_events.py +0 -107
- unrealon_llm/src/llm_logging/llm_logger.py +0 -466
- unrealon_llm/src/managers/__init__.py +0 -15
- unrealon_llm/src/managers/cache_manager.py +0 -67
- unrealon_llm/src/managers/cost_manager.py +0 -107
- unrealon_llm/src/managers/request_manager.py +0 -298
- unrealon_llm/src/modules/__init__.py +0 -0
- unrealon_llm/src/modules/html_processor/__init__.py +0 -25
- unrealon_llm/src/modules/html_processor/base_processor.py +0 -415
- unrealon_llm/src/modules/html_processor/details_processor.py +0 -85
- unrealon_llm/src/modules/html_processor/listing_processor.py +0 -91
- unrealon_llm/src/modules/html_processor/models/__init__.py +0 -20
- unrealon_llm/src/modules/html_processor/models/processing_models.py +0 -40
- unrealon_llm/src/modules/html_processor/models/universal_model.py +0 -56
- unrealon_llm/src/modules/html_processor/processor.py +0 -102
- unrealon_llm/src/modules/llm/__init__.py +0 -0
- unrealon_llm/src/modules/translator/__init__.py +0 -0
- unrealon_llm/src/provider.py +0 -116
- unrealon_llm/src/utils/__init__.py +0 -95
- unrealon_llm/src/utils/common.py +0 -64
- unrealon_llm/src/utils/data_extractor.py +0 -188
- unrealon_llm/src/utils/html_cleaner.py +0 -767
- unrealon_llm/src/utils/language_detector.py +0 -308
- unrealon_llm/src/utils/models_cache.py +0 -592
- unrealon_llm/src/utils/smart_counter.py +0 -229
- unrealon_llm/src/utils/token_counter.py +0 -189
- unrealon_sdk/README.md +0 -25
- unrealon_sdk/__init__.py +0 -30
- unrealon_sdk/pyproject.toml +0 -231
- unrealon_sdk/src/__init__.py +0 -150
- unrealon_sdk/src/cli/__init__.py +0 -12
- unrealon_sdk/src/cli/commands/__init__.py +0 -22
- unrealon_sdk/src/cli/commands/benchmark.py +0 -42
- unrealon_sdk/src/cli/commands/diagnostics.py +0 -573
- unrealon_sdk/src/cli/commands/health.py +0 -46
- unrealon_sdk/src/cli/commands/integration.py +0 -498
- unrealon_sdk/src/cli/commands/reports.py +0 -43
- unrealon_sdk/src/cli/commands/security.py +0 -36
- unrealon_sdk/src/cli/commands/server.py +0 -483
- unrealon_sdk/src/cli/commands/servers.py +0 -56
- unrealon_sdk/src/cli/commands/tests.py +0 -55
- unrealon_sdk/src/cli/main.py +0 -126
- unrealon_sdk/src/cli/utils/reporter.py +0 -519
- unrealon_sdk/src/clients/openapi.yaml +0 -3347
- unrealon_sdk/src/clients/python_http/__init__.py +0 -3
- unrealon_sdk/src/clients/python_http/api_config.py +0 -228
- unrealon_sdk/src/clients/python_http/models/BaseModel.py +0 -12
- unrealon_sdk/src/clients/python_http/models/BroadcastDeliveryStats.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastMessage.py +0 -17
- unrealon_sdk/src/clients/python_http/models/BroadcastMessageRequest.py +0 -35
- unrealon_sdk/src/clients/python_http/models/BroadcastPriority.py +0 -10
- unrealon_sdk/src/clients/python_http/models/BroadcastResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/BroadcastResultResponse.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastTarget.py +0 -11
- unrealon_sdk/src/clients/python_http/models/ConnectionStats.py +0 -27
- unrealon_sdk/src/clients/python_http/models/ConnectionsResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/DeveloperMessageResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ErrorResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/HTTPValidationError.py +0 -16
- unrealon_sdk/src/clients/python_http/models/HealthResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/HealthStatus.py +0 -33
- unrealon_sdk/src/clients/python_http/models/LogLevel.py +0 -10
- unrealon_sdk/src/clients/python_http/models/LoggingRequest.py +0 -27
- unrealon_sdk/src/clients/python_http/models/LoggingResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/MaintenanceMode.py +0 -9
- unrealon_sdk/src/clients/python_http/models/MaintenanceModeRequest.py +0 -33
- unrealon_sdk/src/clients/python_http/models/MaintenanceStatusResponse.py +0 -39
- unrealon_sdk/src/clients/python_http/models/ParserCommandRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserMessageResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationRequest.py +0 -28
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserType.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyBlockRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyEndpointResponse.py +0 -20
- unrealon_sdk/src/clients/python_http/models/ProxyListResponse.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyProvider.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyPurchaseRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ProxyResponse.py +0 -47
- unrealon_sdk/src/clients/python_http/models/ProxyRotationRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ProxyStatus.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyUsageRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyUsageStatsResponse.py +0 -26
- unrealon_sdk/src/clients/python_http/models/ServiceRegistrationDto.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ServiceStatsResponse.py +0 -31
- unrealon_sdk/src/clients/python_http/models/SessionStartRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/SuccessResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/SystemNotificationResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ValidationError.py +0 -18
- unrealon_sdk/src/clients/python_http/models/ValidationErrorResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/WebSocketMetrics.py +0 -21
- unrealon_sdk/src/clients/python_http/models/__init__.py +0 -44
- unrealon_sdk/src/clients/python_http/services/None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/SocketLogging_service.py +0 -187
- unrealon_sdk/src/clients/python_http/services/SystemHealth_service.py +0 -119
- unrealon_sdk/src/clients/python_http/services/WebSocketAPI_service.py +0 -198
- unrealon_sdk/src/clients/python_http/services/__init__.py +0 -0
- unrealon_sdk/src/clients/python_http/services/admin_service.py +0 -125
- unrealon_sdk/src/clients/python_http/services/async_None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/async_ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/async_ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/async_SocketLogging_service.py +0 -189
- unrealon_sdk/src/clients/python_http/services/async_SystemHealth_service.py +0 -123
- unrealon_sdk/src/clients/python_http/services/async_WebSocketAPI_service.py +0 -200
- unrealon_sdk/src/clients/python_http/services/async_admin_service.py +0 -125
- unrealon_sdk/src/clients/python_websocket/__init__.py +0 -28
- unrealon_sdk/src/clients/python_websocket/client.py +0 -490
- unrealon_sdk/src/clients/python_websocket/events.py +0 -732
- unrealon_sdk/src/clients/python_websocket/example.py +0 -136
- unrealon_sdk/src/clients/python_websocket/types.py +0 -871
- unrealon_sdk/src/core/__init__.py +0 -64
- unrealon_sdk/src/core/client.py +0 -556
- unrealon_sdk/src/core/config.py +0 -465
- unrealon_sdk/src/core/exceptions.py +0 -239
- unrealon_sdk/src/core/metadata.py +0 -191
- unrealon_sdk/src/core/models.py +0 -142
- unrealon_sdk/src/core/types.py +0 -68
- unrealon_sdk/src/dto/__init__.py +0 -268
- unrealon_sdk/src/dto/authentication.py +0 -108
- unrealon_sdk/src/dto/cache.py +0 -208
- unrealon_sdk/src/dto/common.py +0 -19
- unrealon_sdk/src/dto/concurrency.py +0 -393
- unrealon_sdk/src/dto/events.py +0 -108
- unrealon_sdk/src/dto/health.py +0 -339
- unrealon_sdk/src/dto/load_balancing.py +0 -336
- unrealon_sdk/src/dto/logging.py +0 -230
- unrealon_sdk/src/dto/performance.py +0 -165
- unrealon_sdk/src/dto/rate_limiting.py +0 -295
- unrealon_sdk/src/dto/resource_pooling.py +0 -128
- unrealon_sdk/src/dto/structured_logging.py +0 -112
- unrealon_sdk/src/dto/task_scheduling.py +0 -121
- unrealon_sdk/src/dto/websocket.py +0 -55
- unrealon_sdk/src/enterprise/__init__.py +0 -59
- unrealon_sdk/src/enterprise/authentication.py +0 -401
- unrealon_sdk/src/enterprise/cache_manager.py +0 -578
- unrealon_sdk/src/enterprise/error_recovery.py +0 -494
- unrealon_sdk/src/enterprise/event_system.py +0 -549
- unrealon_sdk/src/enterprise/health_monitor.py +0 -747
- unrealon_sdk/src/enterprise/load_balancer.py +0 -964
- unrealon_sdk/src/enterprise/logging/__init__.py +0 -68
- unrealon_sdk/src/enterprise/logging/cleanup.py +0 -156
- unrealon_sdk/src/enterprise/logging/development.py +0 -744
- unrealon_sdk/src/enterprise/logging/service.py +0 -410
- unrealon_sdk/src/enterprise/multithreading_manager.py +0 -853
- unrealon_sdk/src/enterprise/performance_monitor.py +0 -539
- unrealon_sdk/src/enterprise/proxy_manager.py +0 -696
- unrealon_sdk/src/enterprise/rate_limiter.py +0 -652
- unrealon_sdk/src/enterprise/resource_pool.py +0 -763
- unrealon_sdk/src/enterprise/task_scheduler.py +0 -709
- unrealon_sdk/src/internal/__init__.py +0 -10
- unrealon_sdk/src/internal/command_router.py +0 -497
- unrealon_sdk/src/internal/connection_manager.py +0 -397
- unrealon_sdk/src/internal/http_client.py +0 -446
- unrealon_sdk/src/internal/websocket_client.py +0 -420
- unrealon_sdk/src/provider.py +0 -471
- unrealon_sdk/src/utils.py +0 -234
- /unrealon_browser/{src/cli → cli}/__init__.py +0 -0
- /unrealon_browser/{src/cli → cli}/interactive_mode.py +0 -0
- /unrealon_browser/{src/cli → cli}/main.py +0 -0
- /unrealon_browser/{src/core → core}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/config.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/core.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/dataclasses.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/detection.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/enums.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/statistics.py +0 -0
- /unrealon_browser/{src/managers → managers}/__init__.py +0 -0
- /unrealon_browser/{src/managers → managers}/stealth.py +0 -0
unrealon_browser/__init__.py
CHANGED
|
@@ -1,26 +1,69 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
UnrealOn Browser - Independent Browser Automation Module
|
|
4
3
|
Enterprise-grade browser automation with stealth capabilities and proxy integration.
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
Based on proven patterns from unrealparser with modular architecture.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
from importlib.metadata import version
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
__version__ = version("unrealon")
|
|
12
|
+
except Exception:
|
|
13
|
+
__version__ = "0.1.0"
|
|
14
|
+
|
|
15
|
+
# Core browser management
|
|
16
|
+
from .core import BrowserManager
|
|
10
17
|
|
|
11
|
-
#
|
|
12
|
-
|
|
18
|
+
# Specialized managers
|
|
19
|
+
from .managers import (
|
|
20
|
+
StealthManager,
|
|
21
|
+
ProfileManager,
|
|
22
|
+
CookieManager,
|
|
23
|
+
CaptchaDetector,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Note: CLI interfaces are available as standalone modules
|
|
27
|
+
# Import them directly: from unrealon_browser.cli import BrowserCLI, CookiesCLI
|
|
13
28
|
|
|
29
|
+
# API client
|
|
30
|
+
try:
|
|
31
|
+
from .api import BrowserApiClient
|
|
32
|
+
except ImportError:
|
|
33
|
+
BrowserApiClient = None
|
|
14
34
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
|
|
36
|
+
# Data models
|
|
37
|
+
from .dto import (
|
|
38
|
+
BrowserConfig,
|
|
39
|
+
BrowserType,
|
|
40
|
+
BrowserMode,
|
|
41
|
+
BrowserSessionStatus,
|
|
42
|
+
BrowserSession,
|
|
43
|
+
ProxyInfo,
|
|
44
|
+
CaptchaType,
|
|
45
|
+
CaptchaStatus,
|
|
46
|
+
CaptchaDetectionResult,
|
|
26
47
|
)
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
# Core
|
|
51
|
+
"BrowserManager",
|
|
52
|
+
# Managers
|
|
53
|
+
"StealthManager",
|
|
54
|
+
"ProfileManager",
|
|
55
|
+
"CookieManager",
|
|
56
|
+
"CaptchaDetector",
|
|
57
|
+
# API
|
|
58
|
+
"BrowserApiClient",
|
|
59
|
+
# DTOs (CLI available as: from unrealon_browser.cli import BrowserCLI, CookiesCLI)
|
|
60
|
+
"BrowserConfig",
|
|
61
|
+
"BrowserType",
|
|
62
|
+
"BrowserMode",
|
|
63
|
+
"BrowserSessionStatus",
|
|
64
|
+
"BrowserSession",
|
|
65
|
+
"ProxyInfo",
|
|
66
|
+
"CaptchaType",
|
|
67
|
+
"CaptchaStatus",
|
|
68
|
+
"CaptchaDetectionResult",
|
|
69
|
+
]
|
|
@@ -13,7 +13,7 @@ from rich.panel import Panel
|
|
|
13
13
|
from rich.table import Table
|
|
14
14
|
|
|
15
15
|
# Use existing unrealon_browser API
|
|
16
|
-
from unrealon_browser import BrowserManager, BrowserConfig, BrowserType, BrowserMode
|
|
16
|
+
from unrealon_browser import BrowserManager, BrowserConfig, BrowserType, BrowserMode
|
|
17
17
|
|
|
18
18
|
console = Console()
|
|
19
19
|
|
|
@@ -106,9 +106,7 @@ def interactive():
|
|
|
106
106
|
def _interactive_launch():
|
|
107
107
|
"""Interactive browser launch."""
|
|
108
108
|
parser = questionary.text("Parser name:", default="default_parser").ask()
|
|
109
|
-
browser_type = questionary.select(
|
|
110
|
-
"Browser type:", choices=["chromium", "firefox", "webkit"]
|
|
111
|
-
).ask()
|
|
109
|
+
browser_type = questionary.select("Browser type:", choices=["chromium", "firefox", "webkit"]).ask()
|
|
112
110
|
headless = questionary.confirm("Headless mode?", default=False).ask()
|
|
113
111
|
stealth = questionary.select("Stealth level:", choices=["disabled", "basic", "advanced"]).ask()
|
|
114
112
|
url = questionary.text("URL to navigate:", default="https://bot.sannysoft.com").ask()
|
|
@@ -151,9 +149,7 @@ def _show_browser_statistics():
|
|
|
151
149
|
console.print(table)
|
|
152
150
|
|
|
153
151
|
|
|
154
|
-
async def _run_browser_session(
|
|
155
|
-
parser: str, browser_type: str, headless: bool, stealth: str, url: str
|
|
156
|
-
):
|
|
152
|
+
async def _run_browser_session(parser: str, browser_type: str, headless: bool, stealth: str, url: str):
|
|
157
153
|
"""Simple wrapper using existing BrowserManager API."""
|
|
158
154
|
try:
|
|
159
155
|
# Use existing BrowserConfig
|
|
@@ -161,7 +157,7 @@ async def _run_browser_session(
|
|
|
161
157
|
parser_name=parser,
|
|
162
158
|
browser_type=BrowserType(browser_type.lower()),
|
|
163
159
|
mode=BrowserMode.HEADLESS if headless else BrowserMode.HEADED,
|
|
164
|
-
stealth_level
|
|
160
|
+
# stealth_level removed - STEALTH ALWAYS ON!
|
|
165
161
|
)
|
|
166
162
|
|
|
167
163
|
# Use existing BrowserManager - no duplication!
|
|
@@ -170,9 +166,7 @@ async def _run_browser_session(
|
|
|
170
166
|
console.print("[cyan]Using existing BrowserManager API...[/cyan]")
|
|
171
167
|
|
|
172
168
|
await browser_manager.initialize_async()
|
|
173
|
-
console.print(
|
|
174
|
-
f"[green]✅ Browser ready (Session: {browser_manager.session_metadata.session_id})[/green]"
|
|
175
|
-
)
|
|
169
|
+
console.print(f"[green]✅ Browser ready (Session: {browser_manager.session_metadata.session_id})[/green]")
|
|
176
170
|
|
|
177
171
|
result = await browser_manager.navigate_async(url)
|
|
178
172
|
|
|
@@ -200,7 +194,7 @@ async def _run_stealth_test(parser: str, url: str):
|
|
|
200
194
|
parser_name=parser,
|
|
201
195
|
browser_type=BrowserType.CHROMIUM,
|
|
202
196
|
mode=BrowserMode.HEADLESS,
|
|
203
|
-
stealth_level
|
|
197
|
+
# stealth_level removed - STEALTH ALWAYS ON!
|
|
204
198
|
)
|
|
205
199
|
|
|
206
200
|
browser_manager = BrowserManager(config)
|
|
@@ -222,7 +216,6 @@ async def _run_automation_workflow(parser: str, url: str):
|
|
|
222
216
|
config = BrowserConfig(
|
|
223
217
|
parser_name=parser,
|
|
224
218
|
browser_type=BrowserType.CHROMIUM,
|
|
225
|
-
stealth_level=StealthLevel.ADVANCED,
|
|
226
219
|
)
|
|
227
220
|
|
|
228
221
|
browser_manager = BrowserManager(config)
|
|
@@ -393,5 +393,9 @@ def _clear_proxy_cookies(cookies_file: Path, proxy_key: str):
|
|
|
393
393
|
console.print(f"[red]❌ Error clearing cookies: {e}[/red]")
|
|
394
394
|
|
|
395
395
|
|
|
396
|
-
|
|
396
|
+
def main():
|
|
397
|
+
"""Main entry point for cookies CLI."""
|
|
397
398
|
cookies()
|
|
399
|
+
|
|
400
|
+
if __name__ == "__main__":
|
|
401
|
+
main()
|
|
@@ -11,7 +11,7 @@ from datetime import datetime, timezone
|
|
|
11
11
|
from typing import Optional, Dict, Any, Union
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
|
|
14
|
-
from unrealon_browser.
|
|
14
|
+
from unrealon_browser.dto import (
|
|
15
15
|
BrowserConfig,
|
|
16
16
|
BrowserSession,
|
|
17
17
|
BrowserSessionStatus,
|
|
@@ -22,7 +22,7 @@ from unrealon_browser.src.dto import (
|
|
|
22
22
|
PageResult,
|
|
23
23
|
ProxyInfo,
|
|
24
24
|
)
|
|
25
|
-
from unrealon_browser.
|
|
25
|
+
from unrealon_browser.managers import (
|
|
26
26
|
StealthManager,
|
|
27
27
|
ProfileManager,
|
|
28
28
|
CookieManager,
|
|
@@ -10,7 +10,7 @@ from typing import Dict, List, Optional, Any, Union
|
|
|
10
10
|
from datetime import datetime, timezone
|
|
11
11
|
|
|
12
12
|
# Browser DTOs
|
|
13
|
-
from unrealon_browser.
|
|
13
|
+
from unrealon_browser.dto import ProxyInfo, CookieMetadata
|
|
14
14
|
|
|
15
15
|
# Playwright imports
|
|
16
16
|
from playwright.async_api import Page, BrowserContext
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Logger Bridge - Integration bridge between unrealon_browser and unrealon_driver loggers
|
|
3
|
+
Layer 2.5: Logging Integration - Connects independent browser module with driver enterprise loggers
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Optional, Any, Dict
|
|
7
|
+
from datetime import datetime, timezone
|
|
8
|
+
import uuid
|
|
9
|
+
|
|
10
|
+
# Browser DTOs
|
|
11
|
+
from unrealon_browser.dto import (
|
|
12
|
+
BrowserSessionStatus,
|
|
13
|
+
BrowserSession,
|
|
14
|
+
CaptchaDetectionResult,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
# Import from unrealon_driver
|
|
18
|
+
from unrealon_driver.parser.managers.logging import LoggingManager, LoggingConfig, LogLevel, get_logging_manager
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class BrowserLoggerBridge:
|
|
22
|
+
"""
|
|
23
|
+
Bridge between unrealon_browser and unrealon_driver loggers
|
|
24
|
+
|
|
25
|
+
Provides unified logging interface for browser operations using
|
|
26
|
+
the driver's LoggingManager for consistent logging across the ecosystem.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
session_id: Optional[str] = None,
|
|
32
|
+
bridge_client: Optional[Any] = None,
|
|
33
|
+
enable_console: bool = True,
|
|
34
|
+
):
|
|
35
|
+
"""Initialize logger bridge"""
|
|
36
|
+
self.session_id = session_id or str(uuid.uuid4())
|
|
37
|
+
|
|
38
|
+
# Create logging manager from driver
|
|
39
|
+
self.logger = get_logging_manager(parser_name="unrealon_browser", bridge_client=bridge_client, console_enabled=enable_console, file_enabled=True, bridge_enabled=bridge_client is not None)
|
|
40
|
+
|
|
41
|
+
# Set session context
|
|
42
|
+
self.logger.set_session(self.session_id)
|
|
43
|
+
|
|
44
|
+
# Statistics
|
|
45
|
+
self._events_logged = 0
|
|
46
|
+
self._browser_events = {
|
|
47
|
+
"browser_initialized": 0,
|
|
48
|
+
"navigation_success": 0,
|
|
49
|
+
"navigation_failed": 0,
|
|
50
|
+
"stealth_applied": 0,
|
|
51
|
+
"captcha_detected": 0,
|
|
52
|
+
"captcha_solved": 0,
|
|
53
|
+
"profile_created": 0,
|
|
54
|
+
"cookies_saved": 0,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
self._log_debug(f"BrowserLoggerBridge initialized for session {self.session_id}")
|
|
58
|
+
|
|
59
|
+
def _log_debug(self, message: str, **context: Any) -> None:
|
|
60
|
+
"""Debug level logging using driver logger"""
|
|
61
|
+
self._events_logged += 1
|
|
62
|
+
self.logger.debug(message, **context)
|
|
63
|
+
|
|
64
|
+
def _log_info(self, message: str, **context: Any) -> None:
|
|
65
|
+
"""Info level logging using driver logger"""
|
|
66
|
+
self._events_logged += 1
|
|
67
|
+
self.logger.info(message, **context)
|
|
68
|
+
|
|
69
|
+
def _log_warning(self, message: str, **context: Any) -> None:
|
|
70
|
+
"""Warning level logging using driver logger"""
|
|
71
|
+
self._events_logged += 1
|
|
72
|
+
self.logger.warning(message, **context)
|
|
73
|
+
|
|
74
|
+
def _log_error(self, message: str, **context: Any) -> None:
|
|
75
|
+
"""Error level logging using driver logger"""
|
|
76
|
+
self._events_logged += 1
|
|
77
|
+
self.logger.error(message, **context)
|
|
78
|
+
|
|
79
|
+
# Browser-specific logging methods
|
|
80
|
+
def log_browser_initialized(self, metadata: BrowserSession) -> None:
|
|
81
|
+
"""Log browser initialization"""
|
|
82
|
+
self._browser_events["browser_initialized"] += 1
|
|
83
|
+
self._log_info(
|
|
84
|
+
f"Browser session initialized: {metadata.session_id}",
|
|
85
|
+
session_id=metadata.session_id,
|
|
86
|
+
parser_name=metadata.parser_name,
|
|
87
|
+
browser_type=metadata.browser_type or "unknown",
|
|
88
|
+
stealth_level="unknown",
|
|
89
|
+
proxy_host=getattr(metadata.proxy, "host", None) if metadata.proxy else None,
|
|
90
|
+
proxy_port=getattr(metadata.proxy, "port", None) if metadata.proxy else None,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def log_navigation_success(self, url: str, title: str, duration_ms: float) -> None:
|
|
94
|
+
"""Log successful navigation"""
|
|
95
|
+
self._browser_events["navigation_success"] += 1
|
|
96
|
+
self._log_info(
|
|
97
|
+
f"Navigation successful: {title}",
|
|
98
|
+
url=url,
|
|
99
|
+
title=title,
|
|
100
|
+
duration_ms=duration_ms,
|
|
101
|
+
navigation_type="browser_navigation",
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def log_navigation_failed(self, url: str, error: str, duration_ms: float) -> None:
|
|
105
|
+
"""Log failed navigation"""
|
|
106
|
+
self._browser_events["navigation_failed"] += 1
|
|
107
|
+
self._log_error(
|
|
108
|
+
f"Navigation failed: {url}",
|
|
109
|
+
url=url,
|
|
110
|
+
error_message=error,
|
|
111
|
+
duration_ms=duration_ms,
|
|
112
|
+
navigation_type="browser_navigation",
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
def log_stealth_applied(self, stealth_level: str, success: bool) -> None:
|
|
116
|
+
"""Log stealth application - 🔥 STEALTH ALWAYS ON!"""
|
|
117
|
+
self._browser_events["stealth_applied"] += 1
|
|
118
|
+
|
|
119
|
+
if success:
|
|
120
|
+
self._log_info(
|
|
121
|
+
f"Stealth measures applied: {stealth_level}",
|
|
122
|
+
stealth_level=stealth_level,
|
|
123
|
+
stealth_success=True,
|
|
124
|
+
)
|
|
125
|
+
else:
|
|
126
|
+
self._log_warning(
|
|
127
|
+
f"Stealth application failed: {stealth_level}",
|
|
128
|
+
stealth_level=stealth_level,
|
|
129
|
+
stealth_success=False,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
def log_captcha_detected(self, result: CaptchaDetectionResult) -> None:
|
|
133
|
+
"""Log captcha detection"""
|
|
134
|
+
self._browser_events["captcha_detected"] += 1
|
|
135
|
+
self._log_warning(
|
|
136
|
+
f"Captcha detected: {result.captcha_type.value}",
|
|
137
|
+
captcha_type=result.captcha_type.value,
|
|
138
|
+
page_url=result.page_url,
|
|
139
|
+
proxy_host=result.proxy_host,
|
|
140
|
+
proxy_port=result.proxy_port,
|
|
141
|
+
detected_at=result.detected_at.isoformat(),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
def log_captcha_solved(self, proxy_host: str, proxy_port: int, manual: bool = True) -> None:
|
|
145
|
+
"""Log captcha resolution"""
|
|
146
|
+
self._browser_events["captcha_solved"] += 1
|
|
147
|
+
self._log_info(
|
|
148
|
+
f"Captcha solved for proxy {proxy_host}:{proxy_port}",
|
|
149
|
+
proxy_host=proxy_host,
|
|
150
|
+
proxy_port=proxy_port,
|
|
151
|
+
resolution_method="manual" if manual else "automatic",
|
|
152
|
+
cookies_will_be_saved=True,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
def log_profile_created(self, profile_name: str, proxy_info: Optional[Dict[str, Any]] = None) -> None:
|
|
156
|
+
"""Log profile creation"""
|
|
157
|
+
self._browser_events["profile_created"] += 1
|
|
158
|
+
context = {"profile_name": profile_name}
|
|
159
|
+
if proxy_info:
|
|
160
|
+
context.update(proxy_info)
|
|
161
|
+
|
|
162
|
+
self._log_info(f"Browser profile created: {profile_name}", **context)
|
|
163
|
+
|
|
164
|
+
def log_cookies_saved(self, proxy_host: str, proxy_port: int, cookies_count: int, parser_name: str) -> None:
|
|
165
|
+
"""Log cookie saving"""
|
|
166
|
+
self._browser_events["cookies_saved"] += 1
|
|
167
|
+
self._log_info(
|
|
168
|
+
f"Cookies saved for {proxy_host}:{proxy_port}",
|
|
169
|
+
proxy_host=proxy_host,
|
|
170
|
+
proxy_port=proxy_port,
|
|
171
|
+
cookies_count=cookies_count,
|
|
172
|
+
parser_name=parser_name,
|
|
173
|
+
storage_type="proxy_bound",
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
def log_performance_metric(self, metric_name: str, value: float, unit: str, threshold: Optional[float] = None) -> None:
|
|
177
|
+
"""Log performance metrics"""
|
|
178
|
+
exceeded = threshold is not None and value > threshold
|
|
179
|
+
level = "WARNING" if exceeded else "DEBUG"
|
|
180
|
+
message = f"Performance: {metric_name} = {value} {unit}"
|
|
181
|
+
if threshold:
|
|
182
|
+
message += f" (threshold: {threshold})"
|
|
183
|
+
|
|
184
|
+
if exceeded:
|
|
185
|
+
self._log_warning(message, metric=metric_name, value=value, unit=unit, threshold=threshold)
|
|
186
|
+
else:
|
|
187
|
+
self._log_debug(message, metric=metric_name, value=value, unit=unit, threshold=threshold)
|
|
188
|
+
|
|
189
|
+
def get_statistics(self) -> Dict[str, Any]:
|
|
190
|
+
"""Get logging statistics"""
|
|
191
|
+
return {
|
|
192
|
+
"total_events_logged": self._events_logged,
|
|
193
|
+
"browser_events": self._browser_events.copy(),
|
|
194
|
+
"session_id": self.session_id,
|
|
195
|
+
"logger_stats": self.logger.get_log_stats(),
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
def print_statistics(self) -> None:
|
|
199
|
+
"""Print logging statistics"""
|
|
200
|
+
stats = self.get_statistics()
|
|
201
|
+
|
|
202
|
+
print("\n📊 Browser Logger Bridge Statistics:")
|
|
203
|
+
print(f" Total events logged: {stats['total_events_logged']}")
|
|
204
|
+
print(f" Session ID: {stats['session_id']}")
|
|
205
|
+
|
|
206
|
+
print(" Browser events:")
|
|
207
|
+
for event, count in stats["browser_events"].items():
|
|
208
|
+
print(f" {event}: {count}")
|
|
209
|
+
|
|
210
|
+
print(" Logger stats:")
|
|
211
|
+
for key, value in stats["logger_stats"].items():
|
|
212
|
+
print(f" {key}: {value}")
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
# Factory function for easy integration
|
|
216
|
+
def create_browser_logger_bridge(
|
|
217
|
+
session_id: Optional[str] = None,
|
|
218
|
+
bridge_client: Optional[Any] = None,
|
|
219
|
+
enable_console: bool = True,
|
|
220
|
+
) -> BrowserLoggerBridge:
|
|
221
|
+
"""
|
|
222
|
+
Create browser logger bridge with driver integration
|
|
223
|
+
|
|
224
|
+
This function creates a logger bridge that uses the driver's LoggingManager
|
|
225
|
+
for consistent logging across the ecosystem.
|
|
226
|
+
"""
|
|
227
|
+
return BrowserLoggerBridge(
|
|
228
|
+
session_id=session_id,
|
|
229
|
+
bridge_client=bridge_client,
|
|
230
|
+
enable_console=enable_console,
|
|
231
|
+
)
|
|
@@ -10,7 +10,7 @@ from datetime import datetime, timezone
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
from typing import Dict, Any, Optional, List, Union
|
|
12
12
|
|
|
13
|
-
from unrealon_browser.
|
|
13
|
+
from unrealon_browser.dto import ProfileType, ProxyInfo
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class ProfileManager:
|
unrealon_driver/__init__.py
CHANGED
|
@@ -1,26 +1,80 @@
|
|
|
1
1
|
"""
|
|
2
|
-
🚀 UnrealOn Driver -
|
|
2
|
+
🚀 UnrealOn Driver v4.0 - Modern Parser Framework
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"""
|
|
4
|
+
Revolutionary parser framework with specialized managers and zero configuration.
|
|
5
|
+
Built on unrealon-rpc bridge with full Pydantic v2 compliance.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Key Features:
|
|
8
|
+
- 🎯 Zero Configuration: Everything works out of the box
|
|
9
|
+
- 🏗️ Manager Architecture: Specialized managers for different concerns
|
|
10
|
+
- 🌐 Smart Browser: Intelligent automation with stealth
|
|
11
|
+
- 🧹 HTML Cleaning: Optimized for LLM analysis
|
|
12
|
+
- 🔌 Bridge Integration: Built on unrealon-rpc bridge
|
|
13
|
+
- 📊 Built-in Monitoring: Enterprise observability
|
|
14
|
+
- 🛡️ Type Safety: Full Pydantic v2 compliance
|
|
15
|
+
"""
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
__description__ = "Simple, modular parser development tools for UnrealOn SDK"
|
|
17
|
+
from importlib.metadata import version
|
|
13
18
|
|
|
19
|
+
try:
|
|
20
|
+
__version__ = version("unrealon")
|
|
21
|
+
except Exception:
|
|
22
|
+
__version__ = "1.1.0"
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
from .parser import (
|
|
25
|
+
ParserManager,
|
|
26
|
+
ParserManagerConfig,
|
|
27
|
+
ParserStats,
|
|
28
|
+
get_parser_manager,
|
|
29
|
+
quick_parse,
|
|
30
|
+
ConfigManager,
|
|
31
|
+
ParserConfig,
|
|
32
|
+
ResultManager,
|
|
33
|
+
ParseResult,
|
|
34
|
+
ParseMetrics,
|
|
35
|
+
ErrorManager,
|
|
36
|
+
RetryConfig,
|
|
37
|
+
ErrorInfo,
|
|
38
|
+
LoggingManager,
|
|
39
|
+
LoggingConfig,
|
|
40
|
+
LogLevel,
|
|
41
|
+
HTMLManager,
|
|
42
|
+
HTMLCleaningConfig,
|
|
43
|
+
BrowserManager,
|
|
44
|
+
BrowserConfig,
|
|
26
45
|
)
|
|
46
|
+
from .exceptions import ParserError, BrowserError
|
|
47
|
+
|
|
48
|
+
__all__ = [
|
|
49
|
+
# Main Parser Manager
|
|
50
|
+
"ParserManager",
|
|
51
|
+
"ParserManagerConfig",
|
|
52
|
+
"ParserStats",
|
|
53
|
+
"get_parser_manager",
|
|
54
|
+
"quick_parse",
|
|
55
|
+
# Individual Managers
|
|
56
|
+
"ConfigManager",
|
|
57
|
+
"ParserConfig",
|
|
58
|
+
"ResultManager",
|
|
59
|
+
"ParseResult",
|
|
60
|
+
"ParseMetrics",
|
|
61
|
+
"ErrorManager",
|
|
62
|
+
"RetryConfig",
|
|
63
|
+
"ErrorInfo",
|
|
64
|
+
"LoggingManager",
|
|
65
|
+
"LoggingConfig",
|
|
66
|
+
"LogLevel",
|
|
67
|
+
"HTMLManager",
|
|
68
|
+
"HTMLCleaningConfig",
|
|
69
|
+
"BrowserManager",
|
|
70
|
+
"BrowserConfig",
|
|
71
|
+
# Exceptions
|
|
72
|
+
"ParserError",
|
|
73
|
+
"BrowserError",
|
|
74
|
+
# Version
|
|
75
|
+
"__version__",
|
|
76
|
+
]
|
|
77
|
+
# Convenience aliases for backward compatibility
|
|
78
|
+
Parser = ParserManager
|
|
79
|
+
DriverLogger = LoggingManager
|
|
80
|
+
get_driver_logger = LoggingManager
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Browser configuration with Pydantic v2
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Optional, Dict, Any, List
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BrowserConfig(BaseModel):
|
|
11
|
+
"""
|
|
12
|
+
Browser configuration with smart defaults
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
# Browser type and mode
|
|
16
|
+
browser_type: str = Field("chromium", description="Browser type (chromium, firefox, webkit)")
|
|
17
|
+
headless: bool = Field(True, description="Run browser in headless mode")
|
|
18
|
+
|
|
19
|
+
# Stealth and detection
|
|
20
|
+
stealth_mode: bool = Field(True, description="Enable stealth mode")
|
|
21
|
+
user_agent: Optional[str] = Field(None, description="Custom user agent")
|
|
22
|
+
viewport_width: int = Field(1920, description="Viewport width")
|
|
23
|
+
viewport_height: int = Field(1080, description="Viewport height")
|
|
24
|
+
|
|
25
|
+
# Timeouts
|
|
26
|
+
page_timeout: int = Field(30000, description="Page load timeout in milliseconds")
|
|
27
|
+
navigation_timeout: int = Field(30000, description="Navigation timeout in milliseconds")
|
|
28
|
+
element_timeout: int = Field(10000, description="Element wait timeout in milliseconds")
|
|
29
|
+
|
|
30
|
+
# Proxy settings
|
|
31
|
+
proxy_url: Optional[str] = Field(None, description="Proxy URL")
|
|
32
|
+
proxy_username: Optional[str] = Field(None, description="Proxy username")
|
|
33
|
+
proxy_password: Optional[str] = Field(None, description="Proxy password")
|
|
34
|
+
|
|
35
|
+
# Cookie and session management
|
|
36
|
+
persist_cookies: bool = Field(True, description="Persist cookies between sessions")
|
|
37
|
+
cookies_file: Optional[Path] = Field(None, description="Path to cookies file")
|
|
38
|
+
|
|
39
|
+
# Screenshots and debugging
|
|
40
|
+
screenshots_dir: Optional[Path] = Field(None, description="Screenshots directory")
|
|
41
|
+
save_screenshots: bool = Field(False, description="Save screenshots for debugging")
|
|
42
|
+
debug: bool = Field(False, description="Enable debug mode")
|
|
43
|
+
|
|
44
|
+
# Performance settings
|
|
45
|
+
disable_images: bool = Field(False, description="Disable image loading")
|
|
46
|
+
disable_javascript: bool = Field(False, description="Disable JavaScript execution")
|
|
47
|
+
disable_css: bool = Field(False, description="Disable CSS loading")
|
|
48
|
+
|
|
49
|
+
# Browser arguments
|
|
50
|
+
extra_args: List[str] = Field(default_factory=list, description="Additional browser arguments")
|
|
51
|
+
|
|
52
|
+
# Additional settings
|
|
53
|
+
extra_config: Dict[str, Any] = Field(default_factory=dict, description="Additional configuration")
|
|
54
|
+
|
|
55
|
+
class Config:
|
|
56
|
+
"""Pydantic configuration"""
|
|
57
|
+
validate_assignment = True
|
|
58
|
+
extra = "forbid"
|
|
59
|
+
|
|
60
|
+
def model_post_init(self, __context: Any) -> None:
|
|
61
|
+
"""Post-initialization setup"""
|
|
62
|
+
# Setup directories
|
|
63
|
+
if not self.screenshots_dir:
|
|
64
|
+
self.screenshots_dir = Path.cwd() / "system" / "screenshots"
|
|
65
|
+
|
|
66
|
+
if not self.cookies_file:
|
|
67
|
+
self.cookies_file = Path.cwd() / "system" / "cookies.json"
|
|
68
|
+
|
|
69
|
+
# Create directories
|
|
70
|
+
if self.screenshots_dir:
|
|
71
|
+
self.screenshots_dir.mkdir(parents=True, exist_ok=True)
|
|
72
|
+
|
|
73
|
+
if self.cookies_file:
|
|
74
|
+
self.cookies_file.parent.mkdir(parents=True, exist_ok=True)
|