马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import requests
from bs4 import BeautifulSoup
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
}
response = requests.get("https://note.ms/liu2023", headers=headers)
soup = BeautifulSoup(response.text, "lxml")
with open("response.html", "w") as f:
f.write(soup.prettify())
爬取到的结果:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>
Just a moment...
</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<meta content="IE=Edge" http-equiv="X-UA-Compatible"/>
<meta content="noindex,nofollow" name="robots"/>
<meta content="width=device-width,initial-scale=1" name="viewport"/>
<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>
</div>
<script>
(function(){window._cf_chl_opt={cvId: '2',cZone: 'note.ms',cType: 'managed',cNounce: '99612',cRay: '7efb73dd3fc02792',cHash: 'd05f86be02f34c9',cUPMDTk: "\/liu2023?__cf_chl_tk=T4wJrBt5kvKa3Y_lOwLhgFaKqYS.7SHjad.qXnMgUO0-1690865346-0-gaNycGzNCuU",cFPWv: 'b',cTTimeMs: '1000',cMTimeMs: '0',cTplV: 5,cTplB: 'cf',cK: "",fa: "/liu2023?__cf_chl_f_tk=T4wJrBt5kvKa3Y_lOwLhgFaKqYS.7SHjad.qXnMgUO0-1690865346-0-gaNycGzNCuU",md: "zc6bJ_KTsaDwdNAJtJZHEcId6LADx.kjtZ90I4KI7mI-1690865346-0-AbvtTf0qPnqpkxop_FnT--gUqT8i8h2q6gbLCpgF7mWx7GzhC7_G5nojI2ChPx7VMZySg8DYl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bwIsvBhnn8mOP6dq77f/QnDPkbS49fkRyAGgvNWbOTukkArQAtPRrvXPTfpBU2iQ5Xix2QUUskS1gpkB495Pg1vejfBj9E06RIpr9SWW/x1j+HWEN3ZGZTcFYv5rzdnr4SOa+Fx+oWhc7YvjkxndhE7a25bwXRtrR4d7QiQ4MvBixDI5T/ct5QzeU/pXiqN79lr9AwgBKT2kPeXSDupo3IF83mkKvGNvPKwz2R++39Gzr',t: 'MTY5MDg2NTM0Ni4xMTQwMDA=',cT: Math.floor(Date.now() / 1000),m: '98D6sA6uHb+FQiK19Ianh3IJL0ULeGvaL4t/FvBl7WA=',i1: '/YuIIL4LKT+qMLIWVLRZWw==',i2: 'F8XfniEgGRSQs6K02qM1vA==',zh: 'FXLOuMcflenoGWSXNHphMdrow+43VlIE6GoJUz6N6y0=',uh: 'wh0E0SXYnx6pTBdJW/l926I+PRUplRdtQz3K9lHXs/s=',hh: '2U/XHILyR4b8Pj+rdC/0tYF0II4RTXdjikYjDeErd/E=',}};var cpo = document.createElement('script');cpo.src = '/cdn-cgi/challenge-platform/h/b/orchestrate/chl_page/v1?ray=7efb73dd3fc02792';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, "\/liu2023?__cf_chl_rt_tk=T4wJrBt5kvKa3Y_lOwLhgFaKqYS.7SHjad.qXnMgUO0-1690865346-0-gaNycGzNCuU" + window._cf_chl_opt.cOgUHash);cpo.onload = function() {history.replaceState(null, null, ogU);};}document.getElementsByTagName('head')[0].appendChild(cpo);}());
</script>
</body>
</html>
(其中的换行是因为 v p n是敏感词
requests不行,里面执行了js代码,用selenium
|