Convenience function for creating a ready-to-go CloudScraper object. Additional parameters: - rotating_proxies: List of proxy URLs or dict mapping URL schemes to proxy URLs - proxy_options: Dict with proxy configuration options - rotation_strategy: Strat
(cls, sess=None, **kwargs)
| 659 | |
| 660 | @classmethod |
| 661 | def create_scraper(cls, sess=None, **kwargs): |
| 662 | """ |
| 663 | Convenience function for creating a ready-to-go CloudScraper object. |
| 664 | |
| 665 | Additional parameters: |
| 666 | - rotating_proxies: List of proxy URLs or dict mapping URL schemes to proxy URLs |
| 667 | - proxy_options: Dict with proxy configuration options |
| 668 | - rotation_strategy: Strategy for rotating proxies ('sequential', 'random', or 'smart') |
| 669 | - ban_time: Time in seconds to ban a proxy after a failure |
| 670 | - enable_stealth: Whether to enable stealth mode (default: True) |
| 671 | - stealth_options: Dict with stealth mode configuration options |
| 672 | - min_delay: Minimum delay between requests in seconds |
| 673 | - max_delay: Maximum delay between requests in seconds |
| 674 | - human_like_delays: Whether to add random delays between requests |
| 675 | - randomize_headers: Whether to randomize headers |
| 676 | - browser_quirks: Whether to apply browser-specific quirks |
| 677 | - session_refresh_interval: Time in seconds after which to refresh session (default: 3600) |
| 678 | - auto_refresh_on_403: Whether to automatically refresh session on 403 errors (default: True) |
| 679 | - max_403_retries: Maximum number of 403 retry attempts (default: 3) |
| 680 | - min_request_interval: Minimum time in seconds between requests (default: 1.0) |
| 681 | - max_concurrent_requests: Maximum number of concurrent requests (default: 1) |
| 682 | - rotate_tls_ciphers: Whether to rotate TLS cipher suites to avoid detection (default: True) |
| 683 | - disableCloudflareV3: Whether to disable Cloudflare v3 JavaScript VM challenge handling (default: False) |
| 684 | - disableTurnstile: Whether to disable Cloudflare Turnstile challenge handling (default: False) |
| 685 | """ |
| 686 | scraper = cls(**kwargs) |
| 687 | |
| 688 | if sess: |
| 689 | for attr in ['auth', 'cert', 'cookies', 'headers', 'hooks', 'params', 'proxies', 'data']: |
| 690 | val = getattr(sess, attr, None) |
| 691 | if val is not None: |
| 692 | setattr(scraper, attr, val) |
| 693 | |
| 694 | return scraper |
| 695 | |
| 696 | # ------------------------------------------------------------------------------- # |
| 697 | # Functions for integrating cloudscraper with other applications and scripts |
no outgoing calls