Skip to content

Conversation

@zinzied
Copy link
Contributor

@zinzied zinzied commented Jun 10, 2025

  • Final Clean Directory Structure
  • Performance Optimizations:
  • TLS Anti-Detection Features Confirmed Working

zinzied added 3 commits June 10, 2025 09:55
…ual capabilities of the cloudscraper library without false claims or unnecessary promotional content. It provides users with realistic expectations and practical information they can actually use
@masumsoft
Copy link

@zinzied great work. Btw the system currently waits indefinitely for some cases.

For example trying to scrape a stack overflow url gets stuck. Running debug=True shows it's reached max concurrent request, even though there is currently only one request being processed.

@zinzied
Copy link
Contributor Author

zinzied commented Jun 11, 2025

For example trying to scrape a stack overflow url gets stuck. Running debug=True shows it's reached max concurrent request, even though there is currently only one request being processed.

"Thanks for the additional context! Knowing you're using CloudScraper is really helpful, as it changes the potential source of the 'max concurrent requests' issue.

When CloudScraper gets stuck with that error, even on a single request, it often points to a specific challenge in how it's interacting with Cloudflare, or how its internal mechanisms are handling the anti-bot process. It's possible that a challenge is taking too long to resolve, or a session isn't being properly closed or released, leading CloudScraper to think it still has an 'active' (but stuck) request.

To help us pinpoint this, could you please provide a bit more detail?

  • CloudScraper Version: Which version of CloudScraper are you currently using?
  • Specific Code Snippet: Can you share the exact part of your code where you initialize and use CloudScraper for the URL? This helps us see how you're configuring it.
  • Full Debug Output: If possible, please paste the complete debug output when debug=True is enabled. CloudScraper's debug logs can often reveal detailed steps of the challenge-solving process, which might show exactly where it's hanging.

In the meantime, here are a few CloudScraper-specific troubleshooting steps you might try:

  • Explicit Session Closing: Ensure you're explicitly closing the CloudScraper session after you're done with it, especially if you're making multiple requests over time. For example:
    import cloudscraper
    scraper = cloudscraper.create_scraper()
    try:
        response = scraper.get('your_url_here')
        # Process response
    finally:
        scraper.close() # Ensure the session is closed
  • delay Parameter: Cloudflare can be sensitive to rapid requests. CloudScraper has a delay parameter (often used internally or configurable depending on the method) that might need adjustment if it's getting stuck waiting for a challenge.
  • User-Agent: Sometimes, using a different or more common User-Agent can help, though CloudScraper usually handles this.
  • Proxy Usage: Are you using any proxies with CloudScraper? If so, the proxy itself might be causing the hang-up.
  • Timeout Configuration: Confirm that the timeout parameter you're passing to CloudScraper is sufficient. Sometimes, solving Cloudflare challenges can take longer than a default timeout.
  • CloudScraper Updates: Make sure you're using the latest stable version of CloudScraper (pip install --upgrade cloudscraper). Updates often include fixes for new Cloudflare challenges or improved internal handling.

Once we have more information, especially the debug output, we'll be in a much better position to diagnose why CloudScraper is getting stuck and reporting max concurrent requests. Thanks for your patience!"


@masumsoft
Copy link

@zinzied thanks for the quick reply. I'm directly using the code from your master branch. Here is my code snippet:

Installation

pip install git+https://github.com/zinzied/cloudscraper.git@8f13e9a9d1b1d8ff9108f713e3f9c8462cd37dce

Code Snippet

import cloudscraper
scraper = cloudscraper.create_scraper(browser={'custom': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36'}, debug=True)
response = scraper.get('https://stackoverflow.com/questions/381806/large-public-datasets', timeout=10)
print(response.status_code)

Debug Output

< GET /questions/381806/large-public-datasets HTTP/1.1
< Host: stackoverflow.com
< User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
< Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
< Accept-Language: en-GB,en;q=0.9,en-US;q=0.8
< Accept-Encoding: gzip, deflate, br
< sec-ch-ua: "Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"
< sec-ch-ua-mobile: ?0
< sec-ch-ua-platform: "Windows"
< Sec-Fetch-Site: none
< Sec-Fetch-Mode: navigate
< Sec-Fetch-User: ?1
< Sec-Fetch-Dest: document
< DNT: 1
< 

> HTTP/1.1 403 Forbidden
> Date: Wed, 11 Jun 2025 13:08:15 GMT
> Content-Type: text/html; charset=UTF-8
> Transfer-Encoding: chunked
> Connection: close
> accept-ch: Sec-CH-UA-Bitness, Sec-CH-UA-Arch, Sec-CH-UA-Full-Version, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Platform, Sec-CH-UA, UA-Bitness, UA-Arch, UA-Full-Version, UA-Mobile, UA-Model, UA-Platform-Version, UA-Platform, UA
> cf-mitigated: challenge
> critical-ch: Sec-CH-UA-Bitness, Sec-CH-UA-Arch, Sec-CH-UA-Full-Version, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Platform, Sec-CH-UA, UA-Bitness, UA-Arch, UA-Full-Version, UA-Mobile, UA-Model, UA-Platform-Version, UA-Platform, UA
> cross-origin-embedder-policy: require-corp
> cross-origin-opener-policy: same-origin
> cross-origin-resource-policy: same-origin
> origin-agent-cluster: ?1
> permissions-policy: accelerometer=(),autoplay=(),browsing-topics=(),camera=(),clipboard-read=(),clipboard-write=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()
> referrer-policy: same-origin
> server-timing: chlray;desc="94e1560fafa4dae4"
> x-content-type-options: nosniff
> x-frame-options: SAMEORIGIN
> Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
> Expires: Thu, 01 Jan 1970 00:00:01 GMT
> Set-Cookie: __cf_bm=hpk.1lwPWC7KbW.yZQaiC1VSiPlnzGNuFTE.HSafFdc-1749647295-1.0.1.1-iFCeHxq9CNfEqTksNUQj.0AIIcVDOJoSG4GPYoiVo7xi3tI6kqmUdTO_KXwhqnXT.UD_1hwbk.6FwvdfhJFwAs1lEDNov81mxLjM2n.Jp_E; path=/; expires=Wed, 11-Jun-25 13:38:15 GMT; domain=.stackoverflow.com; HttpOnly; Secure; SameSite=None
> Vary: Accept-Encoding
> X-DNS-Prefetch-Control: off
> Server: cloudflare
> CF-RAY: 94e1560fafa4dae4-DAC
> Content-Encoding: gzip
> 
<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta name="robots" content="noindex,nofollow"><meta name="viewport" content="width=device-width,initial-scale=1"><style>*{box-sizing:border-box;margin:0;padding:0}html{line-height:1.15;-webkit-text-size-adjust:100%;color:#313131;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}body{display:flex;flex-direction:column;height:100vh;min-height:100vh}.main-content{margin:8rem auto;max-width:60rem;padding-left:1.5rem}@media (width <= 720px){.main-content{margin-top:4rem}}.h2{font-size:1.5rem;font-weight:500;line-height:2.25rem}@media (width <= 720px){.h2{font-size:1.25rem;line-height:1.5rem}}#challenge-error-text{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0IyMEYwMyIgZD0iTTE2IDNhMTMgMTMgMCAxIDAgMTMgMTNBMTMuMDE1IDEzLjAxNSAwIDAgMCAxNiAzbTAgMjRhMTEgMTEgMCAxIDEgMTEtMTEgMTEuMDEgMTEuMDEgMCAwIDEtMTEgMTEiLz48cGF0aCBmaWxsPSIjQjIwRjAzIiBkPSJNMTcuMDM4IDE4LjYxNUgxNC44N0wxNC41NjMgOS41aDIuNzgzem0tMS4wODQgMS40MjdxLjY2IDAgMS4wNTcuMzg4LjQwNy4zODkuNDA3Ljk5NCAwIC41OTYtLjQwNy45ODQtLjM5Ny4zOS0xLjA1Ny4zODktLjY1IDAtMS4wNTYtLjM4OS0uMzk4LS4zODktLjM5OC0uOTg0IDAtLjU5Ny4zOTgtLjk4NS40MDYtLjM5NyAxLjA1Ni0uMzk3Ii8+PC9zdmc+);background-repeat:no-repeat;background-size:contain;padding-left:34px}@media (prefers-color-scheme:dark){body{background-color:#222;color:#d9d9d9}}</style><meta http-equiv="refresh" content="360"></head><body><div class="main-wrapper" role="main"><div class="main-content"><noscript><div class="h2"><span id="challenge-error-text">Enable JavaScript and cookies to continue</span></div></noscript></div></div><script>(function(){window._cf_chl_opt={cvId: '3',cZone: "stackoverflow.com",cType: 'managed',cRay: '94e1560fafa4dae4',cH: 'vxw.hlRnr1Y0BSveqZHSJODxXBRIVPb5eiWMYdDaxXI-1749647295-1.2.1.1-uoTJIbx_ChNkngoGHuc.e2OutY_5QRefIvjvYZswo_4n9EVenCGszTG9LccFHzHc',cUPMDTk: "\/questions\/381806\/large-public-datasets?__cf_chl_tk=ER_Ie7pY2Tv7XWN_vPN5XDEe4SInKeszbw2mmOJOD4k-1749647295-1.0.1.1-ye1gkNICJ4SJvV3CHnmUPHExeWqnirdKR0sE3z9a1v0",cFPWv: 'b',cITimeS: '1749647295',cTplC: 0,cTplV: 5,cTplB: 'cf',fa: "\/questions\/381806\/large-public-datasets?__cf_chl_f_tk=ER_Ie7pY2Tv7XWN_vPN5XDEe4SInKeszbw2mmOJOD4k-1749647295-1.0.1.1-ye1gkNICJ4SJvV3CHnmUPHExeWqnirdKR0sE3z9a1v0",md: "6.j6F1I00qcAVNyU0rfF1fketDVGwaQGE9mvsgezpgE-1749647295-1.2.1.1-x28fQ.64J8Qrk7qUodzcHKqSoexeLF0TCpIuzbdDB8lWLpPglFrbHIEiljhaW2poIHQMj649o5jQf292RJC5mAIh.pKTfyFzBX6LgapfTQ0dArHXz_COtRf4ZJXQetqVXAVaWwjEOSLQWSTKjw_qGkeAgB4Sio7ANQyirbgwXzt1NuJ4ZmVZjFiGxcwsXc5Ibj4Bk91Lid5C7Db0F3siCP.OqS6Oqr25X32PtbRjXB8b1NTlorbbaetYfjxf3wQCSQ0wHcDofqhCTw7qy2FwJnAwpjA2n.JGKl5nIoR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wrszyLrpa0xbo83idyeB2dDIDu7oixiP1kH_.Vdf.bRIVroaBnxoHdRDy0lvM87K2QHBRIlbXG.kvCBSM_jdiocMTCvQvrMjFl.S9JqPnIZ9BIHTMyxEgt_aPyCSWNp9d8oxHCqS7A1cwaiJNV1NwewKXZWaXMA5e_i.ksTgWT1t4Q.4PD7Gwh8lGdUVPlLHunRJ6Vi33NiEgu4zWBFgdoHEjUjGBNjT2qIH2l_2hvi6qXvnCgGOHiqpBfF6xPOgwxWdGyCXAhEGYEqplwzvoeFBcHw.QMJ_ARLLpJTZ57a6cKQ09PyI4kFAyK.VHsEd",};var a = document.createElement('script');a.src = '/cdn-cgi/challenge-platform/h/b/orchestrate/chl_page/v1?ray=94e1560fafa4dae4';window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;if (window.history && window.history.replaceState) {var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;history.replaceState(null, null, "\/questions\/381806\/large-public-datasets?__cf_chl_rt_tk=ER_Ie7pY2Tv7XWN_vPN5XDEe4SInKeszbw2mmOJOD4k-1749647295-1.0.1.1-ye1gkNICJ4SJvV3CHnmUPHExeWqnirdKR0sE3z9a1v0" + window._cf_chl_opt.cOgUHash);a.onload = function() {history.replaceState(null, null, ogU);}}document.getElementsByTagName('head')[0].appendChild(a);}());</script></body></html>
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
⏱️ Request throttling: sleeping 0.95s
🚦 Concurrent request limit reached (1/1), waiting...

@masumsoft
Copy link

Note that after trying your latest commit (2b90912) on the same code this is now an infinite loop:

Debug Output

Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 1)
⏱️ Request throttling: sleeping 0.80s
🔐 Rotated TLS cipher suite (rotation #1)
    Using 8 ciphers starting from index 1
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.98s
🔐 Rotated TLS cipher suite (rotation #2)
    Using 8 ciphers starting from index 2
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.97s
🔐 Rotated TLS cipher suite (rotation #3)
    Using 8 ciphers starting from index 3
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.97s
🔐 Rotated TLS cipher suite (rotation #4)
    Using 8 ciphers starting from index 4
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.97s
🔐 Rotated TLS cipher suite (rotation #5)
    Using 8 ciphers starting from index 5
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.98s
🔐 Rotated TLS cipher suite (rotation #6)
    Using 8 ciphers starting from index 6
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.98s
🔐 Rotated TLS cipher suite (rotation #7)
    Using 8 ciphers starting from index 7
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.98s
🔐 Rotated TLS cipher suite (rotation #8)
    Using 8 ciphers starting from index 8
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)
⏱️ Request throttling: sleeping 0.98s
🔐 Rotated TLS cipher suite (rotation #9)
    Using 8 ciphers starting from index 9
Refreshing session due to staleness or 403 errors...
Cleared Cloudflare cookies for session refresh
🔄 Temporarily reset concurrent counter for session refresh (was 0)

zinzied added 2 commits June 21, 2025 15:12
…ion options for viewport simulation and behavioral patterns. Update README to reflect changes and provide advanced configuration guidance.
…lenge classes to use specific exceptions for improved clarity and logging. Adjust pyproject.toml and setup.py for cleanup and formatting consistency.
@3279444869
Copy link

I used proxy, TLS rotation and sticky proxy IP information. But after running it for a while, it couldn't bypass Cloudflare. I think it was blocked by Cloudflare. Maybe it was because the request TLS was blocked, or maybe it was something else. I paused it for an hour or two, and then ran it again, and it was able to bypass Cloudflare normally. Can you fix this?

 while True:
    try:
        device_id = str(uuid.uuid4().int)[:10]  # 截取10位数字
        state = str(uuid.uuid4())
        url = f'https://accounts.moneylion.com/authorize?clientId=a611942d-d22e-4c24-8f8e-60f08b01cbfc&redirectUri=https%3A%2F%2Fweb.moneylion.com%2Fauth%2Fcallback&deviceId={device_id}&flowEntry=signin&scope=profile&responseType=code&state={state}'
        proxies = [
            'http://user:131421@63027507ad539d47.us.ip2world.vip:6001'.replace('randonm', generate_random_10())
        ]
        ua = get_ua()
        headers = {
            'User-Agent': ua
        }
        scraper = cloudscraper.create_scraper(
            rotating_proxies=proxies,
            delay=5,  # Longer delay for complex challenges
            interpreter='js2py',  # Most compatible interpreter
            enable_stealth=True , # Additional stealth for v3 detection
            auto_refresh_on_403 = False,
            max_403_retries = 8,
            debug = True,
        )
        response = scraper.get(url,headers = headers)
        if response.status_code == 200 or response.status_code == 302:
            logger.info('cookie获取成功')
            return scraper
        scraper.close()
    except:
        pass

@rsforbes
Copy link

@zinzied - Take a look at #298 (TLS Fingerprint Support). I wasn't able to solve this PR, but perhaps you have some insights based on your work.

@zinzied
Copy link
Contributor Author

zinzied commented Jul 9, 2025

@zinzied - Take a look at #298 (TLS Fingerprint Support). I wasn't able to solve this PR, but perhaps you have some insights based on your work.

CloudScraper V3 Handler Enhancements

What This Project Accomplished

I set out to solve a specific problem: accessing prosportstransactions.com, which was blocked by Cloudflare's advanced protection. While I didn't achieve the original goal due to fundamental technical limitations, I made significant improvements to CloudScraper that benefit the entire community.

The Challenge

Modern websites like prosportstransactions.com use sophisticated protection mechanisms that operate at multiple layers:

  1. Application Layer: JavaScript challenges that need to be solved
  2. Transport Layer: TLS fingerprint detection that identifies automated tools

What I Improved ✅

Enhanced Challenge Detection

I think ill upgrade CloudScraper's ability to recognize modern Cloudflare challenges by adding support for:

  • window._cf_chl_opt structures: New challenge format used by modern sites
  • Improved pattern matching: Better regex patterns that catch more challenge types
  • Robust error handling: Graceful fallbacks when parsing fails

zinzied added 3 commits July 15, 2025 19:36
- Introduced PerformanceProfiler, CodeBlockProfiler, MemoryOptimizer, RequestOptimizer, and PerformanceMonitor classes for enhanced performance tracking and optimization.
- Implemented a SessionManager for efficient session handling with automatic cleanup.
- Added ResponseCache for memory-efficient caching with LRU eviction.
- Created advanced usage examples demonstrating stealth mode, proxy rotation, performance monitoring, metrics collection, error handling, and session management.
- Developed async examples showcasing concurrent requests, batch processing, and performance comparison between sync and async operations.
- Established a test suite with fixtures for mocking responses, creating scraper instances, and testing various scenarios.
@vincentkoc
Copy link

Unlike #295 this is not resolving the loopig issue on the TLS

- Added a new TLS fingerprinting module with JA3 fingerprint randomization, cipher suite rotation, and SSL/TLS version negotiation.
- Introduced a CipherSuiteManager for managing cipher suite selection based on browser type.
- Developed a comprehensive TLSFingerprintingManager to handle fingerprint generation and SSL context creation.
- Enhanced the existing CloudScraper with new features for bypassing Cloudflare protections, including intelligent challenge detection and adaptive timing.
- Created a demonstration script showcasing various enhanced bypass scenarios and configurations.
- Increment solve depth counter to avoid infinite recursion
- Return original response if maximum solve depth is reached
- Decrement concurrent requests count upon loop protection with debug logging

perf(timing): optimize adaptive timing parameters and limits

- Reduce base delays and variance in human behavior timing profiles
- Apply more conservative delay increase for low success rates and failures
- Blend learned optimal timings with less influence and apply hard caps
- Cap learning of optimal timings and average response times to avoid extremes
- Lower avg_interval and variance ranges in traffic pattern obfuscation
- Decrease burst controller cooldown base and randomization ranges
- Adjust burst limits adaptively with tighter bounds on cooldowns
- Shorten session idle timing thresholds and reduce min intervals for sessions
@tlg7c5
Copy link

tlg7c5 commented Sep 23, 2025

I tried to use this fork, as I like the robustness it offers, but there was an issue with recursion in the CipherSuiteAdapter in your init.py. I was able to get it working by monkey patching the VeNoMous CipherSuiteAdapter in your fork and it works as expected without recursion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants