有的网站防采集,会在页面加上this.window.location.reload(),这时候你就会得到如下代码:

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   </head>
   <body>
      <iframe height="0" width="0" style="border: 0px;" src="http://www.***.cn/***/***_cookie.html"></iframe>
      <script type="text/javascript">
setTimeout(function(){
         this.window.location.reload();
                }, 1000);
</script></body>
</html>

这样你就取不到他的网页内容了,但是浏览器可以正常显示

这时候你需要在爬虫的时候添加cookie,比较直接的就是静态的添加上浏览器访问时的cookie,也可以根据他的地址动态取(我没有试过动态取)

相关文章:

  • 2022-12-23
  • 2022-03-07
  • 2021-12-29
  • 2021-12-31
  • 2021-09-24
  • 2022-12-23
  • 2022-01-01
猜你喜欢
  • 2022-12-23
  • 2021-07-12
  • 2021-11-14
  • 2022-12-23
  • 2021-11-23
  • 2021-09-14
  • 2022-12-23
相关资源
相似解决方案