kitUIN/PicImageSearch

Ascii2d 触发 Cloudflare

AtropsCooper opened this issue · 3 comments

使用demo_ascii2d.py测试

测试用图片:https://i.328888.xyz/2023/03/27/iUaGFc.jpeg

PicImageSearch/ascii2d.py65行return Ascii2DResponse(resp_text, resp_url)处报错。
原因为未能获取正确的resp_text

详细信息:

resp_url: https://ascii2d.net/search/color/be319b2fa13f0d4edb33ffef1c25aaa0
使用浏览器可以打开

resp_text:

<!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">
    <link href="/cdn-cgi/styles/challenges.css" rel="stylesheet">
    

</head>
<body class="no-js">
    <div class="main-wrapper" role="main">
    <div class="main-content">
        <noscript>
            <div id="challenge-error-title">
                <div class="h2">
                    <span class="icon-wrapper">
                        <div class="heading-icon warning-icon"></div>
                    </span>
                    <span id="challenge-error-text">
                        Enable JavaScript and cookies to continue
                    </span>
                </div>
            </div>
        </noscript>
        <div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=7ae5e4804b7c8d10')"></div>
        <form id="challenge-form" action="/search/color/be319b2fa13f0d4edb33ffef1c25aaa0?__cf_chl_f_tk=xXGHEBrBJltfDIQ5NV_dx9sd5Bcu6s5ZGfwRnkS3rE8-1679901854-0-gaNycGzNClA" method="POST" enctype="application/x-www-form-urlencoded">
            <input type="hidden" name="md" value="0cHzY8t_.IGgep2yExIEYzN2yOKeVXkp4fatYjZIVKU-1679901854-0-AXcDG3aw_Pd3M54LrqHB00oyL3oZL0y5qJBgWC4BjV_mFTwRofN2ZK77IUIr8PqOi6lk5CNdRSAs-hA2jWq_y0UAtrShatLy7ProqRm5a-tuvz7H1pg-9jWy9RM8c8Vm0K9h7D3IftR8uhWiZrNKkvxjBRvX5y5cWklKabrmJ5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R1WDGpOcXItGDiLUNoNyjtDkoaWe-JiSxGS58IF5zy6v4qMM_2OnWxQ1pRBY0lmo_0E7fEmJ4WapzkH6XMy_AvbeIJ3WLAuCbU9cAp-aLS1wknRNrFTdV5jN_8O5sH1aRr9Niee9RJHPcx9cagUpdprJQ4xvq4H-jOYITsXTdWlROQid3zG8FGF6Yuihjz1nq3YvfEtrSKq3bpb2ScgatMAEmdvVXRKJ54">
        </form>
    </div>
</div>
<script>
    (function(){
        window._cf_chl_opt={
            cvId: '2',
            cZone: 'ascii2d.net',
            cType: 'managed',
            cNounce: '52518',
            cRay: '7ae5e4804b7c8d10',
            cHash: 'b5f04b302d5034d',
            cUPMDTk: "\/search\/color\/be319b2fa13f0d4edb33ffef1c25aaa0?__cf_chl_tk=xXGHEBrBJltfDIQ5NV_dx9sd5Bcu6s5ZGfwRnkS3rE8-1679901854-0-gaNycGzNClA",
            cFPWv: 'b',
            cTTimeMs: '1000',
            cMTimeMs: '0',
            cTplV: 5,
            cTplB: 'cf',
            cK: "",
            cRq: {
                ru: 'aHR0cHM6Ly9hc2NpaTJkLm5ldC9zZWFyY2gvY29sb3IvYmUzMTliMmZhMTNmMGQ0ZWRiMzNmZmVmMWMyNWFhYTA=',
                ra: 'Y3VybC83Ljg2LjA=',
                rm: 'R0VU',
                d: 'CIG3IwizvDdruvAjuuu8UWWxIZ7tlvkAjLk6S/KSuobcWOhe4WW78TxMkol0wF4TiE6iKIzYTc+qIx2C5ioCSq/thnk8b28fAw6RLyCV/C6zdq+Jo9MuiwMie4sX7HySYBLvZJwdD0MOL0DH4Zs+NDVKQFq5CnmFHwjyEB/6J0aM3848+2VP13VlTu3QlcDv6X7MMQo/unEZlV1BYps4G0NfQQv4toyXyVQmO9C1jnJj4OTjblSvi18JmkBxxjDLdtWw5eotcTDsePrIHQxfgjmJ8n/8ckwzzJmXFCaTxxCt3fBqsinwefjA4KYJnD7qhji5XsIIGuwExwRslQ/gFB7VwOQ04zvOQg9eO9r/AnEw6EYMSDz3hjxr8FzziD7PDFbgC1gVCHoQSVu+DGkV23BOz9lsoxaLStp7sm2V4cWkqLc8Xuu3cMNh2yH2nNGHgSX64/vbzIzuWZWcGPRh9J2ufRrN5aN8w6oHJdPzEbYk5XnC+EhkAvl79yHIByq1LiQGAD1jfuO3F9sroNGOXA52hRVtXHl4hZOhASP0brMLX/usLIiXE5FaLoXNILAgxiYY4FnEXaZp00foE+q/Jdz+txA5tcYG/jtrG5qXYIp44b3y41B7TXirfNAIss4b',
                t: 'MTY3OTkwMTg1NC43NjkwMDA=',
                m: 'iBax+xWTsLizqO37UyAVpZvPjnpPo0Lqizz0q7t1J1o=',
                i1: 'I0vYAewUJP4nsX+2unXYSQ==',
                i2: 'zspel2P6HpG54isKfDxgBA==',
                zh: 'lBxCieQpkhIHubgKnc9ER+ae9k4MjDZMrA0aIX8vY9I=',
                uh: 'GXKHFIku+R8I38kgjeIt+4x6Zn3zqdqDBGV16lmSN4k=',
                hh: 'UvL/fnJa0zOA1MTuEDgiLTU6TTQ4uCIB+JWwFzj8+nY=',
            }
        };
        var trkjs = document.createElement('img');
        trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=7ae5e4804b7c8d10');
        trkjs.setAttribute('alt', '');
        trkjs.setAttribute('style', 'display: none');
        document.body.appendChild(trkjs);
        var cpo = document.createElement('script');
        cpo.src = '/cdn-cgi/challenge-platform/h/b/orchestrate/managed/v1?ray=7ae5e4804b7c8d10';
        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, "\/search\/color\/be319b2fa13f0d4edb33ffef1c25aaa0?__cf_chl_rt_tk=xXGHEBrBJltfDIQ5NV_dx9sd5Bcu6s5ZGfwRnkS3rE8-1679901854-0-gaNycGzNClA" + window._cf_chl_opt.cOgUHash);
            cpo.onload = function() {
                history.replaceState(null, null, ogU);
            };
        }
        document.getElementsByTagName('head')[0].appendChild(cpo);
    }());
</script>


</body>
</html>

这就是触发 Cloudflare 了,目前没什么简单的解决办法。
你可以试试换个代理节点。

等后续看看是加上 cloudscraper 还是怎么处理。

怎么突然关了?是没再遇到 cf 拦截了吗?

怎么突然关了?是没再遇到 cf 拦截了吗?

直连还是会被拦截。用了 cloudscraper 之后已解决。