Chainguys
2021-07-21 11:35
采纳率: 97.8%
浏览 146
已结题

request很多方式,都被反扒了,是不是只能seleniu?

链接标题

header timeout 等等参数都加了 但是还是返回不了200

是不是只能selenium了?

但是我不想用它,到底存不存在其他方案?

import requests
url = "https://www.coinbase.com/price/s/listed"
dicc = {"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"}
a = requests.get(url, headers = dicc)
print(a.text)

返回的是这样:

html页面效果:
img

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>

<title>Attention Required! | Cloudflare</title>

<meta name="captcha-bypass" id="captcha-bypass" />
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" type="text/css" media="screen,projection" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" type="text/css" media="screen,projection" /><![endif]-->
<style type="text/css">body{margin:0;padding:0}</style>


<!--[if gte IE 10]><!-->
<script>
  if (!navigator.cookieEnabled) {
    window.addEventListener('DOMContentLoaded', function () {
      var cookieEl = document.getElementById('cookie-alert');
      cookieEl.style.display = 'block';
    })
  }
</script>
<!--<![endif]-->


  
    <script type="text/javascript">
    //<![CDATA[
    (function(){
      window._cf_chl_opt={
        cvId: "2",
        cType: "interactive",
        cNounce: "38899",
        cRay: "672177b9499ded57",
        cHash: "cc0e01c474d2fcf",
        cFPWv: "b",
        cTTimeMs: "4000",
        cLt: "n",
        cRq: {
          ru: "aHR0cHM6Ly93d3cuY29pbmJhc2UuY29tL3ByaWNlL3MvbGlzdGVk",
          ra: "TW96aWxsYS81LjAgKE1hY2ludG9zaDsgSW50ZWwgTWFjIE9TIFggMTBfMTVfNykgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzkxLjAuNDQ3Mi4xMTQgU2FmYXJpLzUzNy4zNg==",
          rm: "R0VU",
          d: "T47YDqyBoG8qLpva9eDu/dZZ//eMT7ZFIciULumbuIwJwNbOKLyCOTJzYS0KwzVMzjxICw/BTMFPntNTnYdhA/CZeirpDpRBLs1mg0+rgTjwL8fp7YwVZXLK1hb7/sUye2jCVDdytVVMPzBT3utGc378kH94QZnIxtLEfozayBig/GCXzn8uvowP7xvToA3le7AwC9nZeweLdkyB194QhNBW9hVaLOsO6y8D04cKQDf39Urt3pV7RhgYqccOGaM91rEWnp8yFNV+19l1PydWUy0mo7KqIzZkUsZlw2YFRL6L0oAemNI/1sG0AGTBHvpNJQ4cZ8SerkTjzdhZcouV4G28Zw5zEzKuzWLh0tB414oTBqWJOSInL/UmsziXeVzr0H7N6+GLeHBN+XOlIb0TmM81+vzse4JVqsibWLkKsfvoEw9swyXQylXUNu5FODXX6OwJzj6cFZQM29VeEOGpXycpSm58uaf60iHXPxGB/pWLnP60ndttGr8djMl2jY+aUaCeVfoBCWYyk9OhUguQLNvHM75yrUYb7Q61xmv5djbfLsSrb8Yy7eyr2nP3DVkhe71jhvKIWsB+CMBJnYqRt4OApNTMbGt3H3htSOIHma9lA/YpILTtlfgWJWc7khdLamDNGmtITpokpnF6CoWckn/F41Ox59MjlHC56C5TNkNqufBuU2o3QQ/LGwckhVin1mX14vn9WgFbsCVPL3vcZeoakPaqE3C5L3Qkp1Yt/8bBX9KAppFImGuN3RHdRko3gJ1tkLngko4jsmCTccBVR+WO6Irnir02cskdZoMcUfQCl1+vUa/tOnQHKejwJ/EJRlUu+l+WnDv/7mfaO3soThBC6xXwNQVAGhlPNUtx9lJW/m3tKdsKvzJx/cNCEWp4lPCepyC1zPId9KG2j+2cO+vUj7jkRMvB70pHYhL1Uu4=",
          t: "MTYyNjgzOTQ1My42NTEwMDA=",
          m: "OGvAB4jXJUOmIgO1oRzZWvLYrrMmcNQ5CHI2DZPL97w=",
          i1: "FYfrT4umWNf212c8EL+sVw==",
          i2: "tm/SC8JDxCVkiwP3G+MwIA==",
          zh: "gcAsYHC/e1LCLckuTRLI18a2jyXqZLmumNyE/3B9BHQ=",
          uh: "pDW+wMwkbkqK5qzJfhUdgJSL/IYwYPvFc78XZD/TiKw=",
          hh: "GDiM3gceIh8zwejTPRHi9+zZhdB70tB65PpBGmatj3c=",
        }
      };
    }());
    //]]>
    </script>
  

<style type="text/css">
  #cf-wrapper #spinner {width:69px; margin:  auto;}
  #cf-wrapper #cf-please-wait{text-align:center}
  .attribution {margin-top: 32px;}
  .bubbles { background-color: #f58220; width:20px; height: 20px; margin:2px; border-radius:100%; display:inline-block; }
  #cf-wrapper #challenge-form { padding-top:25px; padding-bottom:25px; }
  #cf-hcaptcha-container { text-align:center;}
  #cf-hcaptcha-container iframe { display: inline-block;}
  @keyframes fader     { 0% {opacity: 0.2;} 50% {opacity: 1.0;} 100% {opacity: 0.2;} }
  #cf-wrapper #cf-bubbles { width:69px; }
  @-webkit-keyframes fader { 0% {opacity: 0.2;} 50% {opacity: 1.0;} 100% {opacity: 0.2;} }
  #cf-bubbles > .bubbles { animation: fader 1.6s infinite;}
  #cf-bubbles > .bubbles:nth-child(2) { animation-delay: .2s;}
  #cf-bubbles > .bubbles:nth-child(3) { animation-delay: .4s;}
</style>
</head>
<body>
  <div id="cf-wrapper">
    <div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>
    <div id="cf-error-details" class="cf-error-details-wrapper">
      <div class="cf-wrapper cf-header cf-error-overview">
      
        <h1 data-translate="challenge_headline">One more step</h1>
        <h2 class="cf-subheadline"><span data-translate="complete_sec_check">Please complete the security check to access</span> www.coinbase.com</h2>
      
      </div>
      
      <div class="cf-section cf-highlight cf-captcha-container">
        <div class="cf-wrapper">
          <div class="cf-columns two">
            <div class="cf-column">
            
              <div class="cf-highlight-inverse cf-form-stacked">
                <form class="challenge-form interactive-form" id="challenge-form" action="/price/s/listed?__cf_chl_captcha_tk__=pmd_c0430c8d3b2293d693ea2937834517274d3db2ab-1626839453-0-gqNtZGzNAvijcnBszQei" method="POST" enctype="application/x-www-form-urlencoded">
  
    <div id='cf-please-wait'>
      <div id='spinner'>
        <div id="cf-bubbles">
            <div class="bubbles"></div>
            <div class="bubbles"></div>
            <div class="bubbles"></div>
        </div>
      </div>
      <p data-translate="please_wait" id="cf-spinner-please-wait">Please stand by, while we are checking your browser...</p>
      <p data-translate="redirecting" id="cf-spinner-redirecting" style="display:none">Redirecting...</p>
      </div>
  
  <input type="hidden" name="md" value="3c852d63018168ecfc62173ea7fc7ff56273ecca-1626839453-0-AaeCMz871j3rfI0YKHBPqF_kzgyI4yJK0tkhq8nJxqViDwTNeh1IADAtA8JNADS9TwcwkbBbTHJtHrJd306eaPnBh8uVjnHrkB35otlMc0mTuo_WzBof-VkQsZb09tB-XTDzgeXIZFzpY98xOGDmwMDMuX472g8ln8wzb4-fP1XCJdvCqKSdPzVcIVZj8J-Bxxaix_rcjmTJh0UCZdONfNuinuzJN1sn3fS1wHlU__5eSV_---EnuYgPjMINYDccQ25rQa9aWevXq4gDktav2oMXaqu537SgSg64LApwbB_1xXXaIvkixDJQgr1HWukvqPfYlWsBvTd72_SnC2ReYgDgtwuoZp4jMjD-dObWFhAHDHnnOfYq-7XxCl4lpGnn_rl8__9AYEO-bvBoN2O3LGUTIf3Wj5n92NO24IkL1ure-2Vh-AvNxT0fXJ5EHRybe2B6YTFG1tZIn6xfdeRJCecPVqoxnlfhtGZyb2qrsL3fvBnKuaV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NnM7d1">
  <input type="hidden" name="cf_captcha_kind" value="h">
  <input type="hidden" name="vc" value="d911e7e8a8e039156ad44583a89def43">
  
  <noscript id="cf-captcha-bookmark" class="cf-captcha-info">
  <h1 data-translate="turn_on_js" style="color:#bd2426;">Please turn JavaScript on and reload the page.</h1>
  </noscript>
    <div id="no-cookie-warning" class="cookie-warning" data-translate="turn_on_cookies" style="display:none">
      <p data-translate="turn_on_cookies" style="color:#bd2426;">Please enable Cookies and reload the page.</p>
    </div>
  <script type="text/javascript">
  //<![CDATA[
    var a = function() {try{return !!window.addEventListener} catch(e) {return !1} },
      b = function(b, c) {a() ? document.addEventListener("DOMContentLoaded", b, c) : document.attachEvent("onreadystatechange", b)};
      b(function(){
        var cookiesEnabled=(navigator.cookieEnabled)? true : false;
        if(!cookiesEnabled){
          var q = document.getElementById('no-cookie-warning');q.style.display = 'block';
        }
      });
  //]]>
  </script>
  <div id="trk_captcha_js" style="background-image:url('/cdn-cgi/images/trace/captcha/nojs/h/transparent.gif?ray=672177b9499ded57')"></div>
</form>
  
  <script type="text/javascript">
    //<![CDATA[
    (function(){
        var isIE = /(MSIE|Trident\/|Edge\/)/i.test(window.navigator.userAgent);
        var trkjs = isIE ? new Image() : document.createElement('img');
        trkjs.setAttribute("src", "/cdn-cgi/images/trace/captcha/js/transparent.gif?ray=672177b9499ded57");
        trkjs.id = "trk_captcha_js";
        trkjs.setAttribute("alt", "");
        document.body.appendChild(trkjs);
        var cpo=document.createElement('script');
        cpo.type='text/javascript';
        cpo.src="/cdn-cgi/challenge-platform/h/b/orchestrate/captcha/v1?ray=672177b9499ded57";
        document.getElementsByTagName('head')[0].appendChild(cpo);
    }());
    //]]>
    </script>
  


              </div>
            </div>

            <div class="cf-column">
              <div class="cf-screenshot-container">
              
                <span class="cf-no-screenshot"></span>
              
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="cf-section cf-wrapper">
        <div class="cf-columns two">
          <div class="cf-column">
            <h2 data-translate="why_captcha_headline">Why do I have to complete a CAPTCHA?</h2>
            
            <p data-translate="why_captcha_detail">Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.</p>
          </div>

          <div class="cf-column">
            <h2 data-translate="resolve_captcha_headline">What can I do to prevent this in the future?</h2>
            

            <p data-translate="resolve_captcha_antivirus">If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.</p>

            <p data-translate="resolve_captcha_network">If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.</p>
            
              
              <p data-translate="resolve_captcha_privacy_pass"> Another way to prevent getting this page in the future is to use Privacy Pass. You may need to download version 2.0 now from the <a rel="noopener noreferrer" href="https://chrome.google.com/webstore/detail/privacy-pass/ajhmfdgkijocedmfjonnpjfojldioehi">Chrome Web Store</a>.</p>
              
            
          </div>
        </div>
      </div>
      

      <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
  <p class="text-13">
    <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">672177b9499ded57</strong></span>
    <span class="cf-footer-separator sm:hidden">&bull;</span>
    <span class="cf-footer-item sm:block sm:mb-1"><span>Your IP</span>: 115.195.124.100</span>
    <span class="cf-footer-separator sm:hidden">&bull;</span>
    <span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link" target="_blank">Cloudflare</a></span>
    
  </p>
</div><!-- /.error-footer -->


    </div>
  </div>

  <script type="text/javascript">
  window._cf_translation = {};
  
  
</script>


</body>
</html>


Process finished with exit code 0


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

  • m0_58995603 2021-07-21 12:49
    最佳回答

    要爬 什么数据,请求的哪个网址,直接放你的代码

    评论
    解决 无用
    打赏 举报
查看更多回答(3条)

相关推荐 更多相似问题