<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88,88);font-family:'微软雅黑';">0×00 前言
<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';">0×01 介绍<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';">0×02 问题的分类<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';">0×03 顺从的艺术<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';">0×04 反爬虫<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';">0×05 Anti-Anti-Spider<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';">0×06 爬虫编写注意事项<p style="margin-bottom:0px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';">0×07 反馈与问题<p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><h2 style="font-family:'微软雅黑';line-height:1.1;color:rgb(55,56,56);margin-top:30px;margin-bottom:15px;font-size:18px;background-color:rgb(255,255,255);"><span style="color:rgb(0,176,80);"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,255);"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;">
<p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';background-color:rgb(255,255);">
<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,88);font-family:'微软雅黑';text-align:center;background-color:rgb(255,255);"><a href="https://image.3001.net/images/20160308/14574159528823.png" rel="nofollow" class="highslide-image" style="color:rgb(6,154,239);background:0px 0px;"><p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);">然后我们打开API页面的商品API页面:<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);"><a href="https://image.3001.net/images/20160308/14574156413956.png" rel="nofollow" class="highslide-image" style="color:rgb(6,239);background:0px 0px;"><p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);">我们发现它提供了不少易用的接口,开发者注册以后可以使用,或者处理一下丢给爬虫去使用。同样的淘宝也有相应的平台,但是应该是收费的,就是淘宝开放平台,要在聚石塔调用API才会生效:<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);"><a href="https://image.3001.net/images/20160308/14574156583556.png" rel="nofollow" class="highslide-image" style="color:rgb(6,239);background:0px 0px;"><p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);"><a href="https://image.3001.net/images/20160308/14574156609693.png" rel="nofollow" class="highslide-image" style="color:rgb(6,239);background:0px 0px;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><h3 style="font-family:'微软雅黑';line-height:1.1;color:rgb(0,112,192);margin-top:20px;margin-bottom:15px;font-size:16px;background-color:rgb(255,255);">2. User-Agent<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);">User-Agent是用户访问网站时候的浏览器的标识<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);">下面我列出了常见的几种正常的系统的User-Agent大家可以参考一下,<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);"><a href="https://image.3001.net/images/20160308/14574159967389.png" rel="nofollow" class="highslide-image" style="color:rgb(6,239);background:0px 0px;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><h3 style="font-family:'微软雅黑';line-height:1.1;color:rgb(0,255);">3、<span style="font-size:7pt;"> 验证码反爬虫<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);">这个办法也是相当古老并且相当的有效果,如果一个爬虫要解释一个验证码中的内容,这在以前通过简单的图像识别是可以完成的,但是就现在来讲,验证码的干扰线,噪点都很多,甚至还出现了人类都难以认识的验证码(某二三零六)。<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);"><a href="https://image.3001.net/images/20160308/14574160358291.png" rel="nofollow" class="highslide-image" style="color:rgb(6,239);background:0px 0px;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);"><span style="font-weight:700;">接下来我们就讨论一些关于反爬虫反制的措施。其实在这段时间内,我总结出一条用于爬虫编写的核心定律:<blockquote style="padding:10px 20px;margin-bottom:20px;font-size:14px;border-left-width:5px;border-left-style:solid;border-left-color:rgb(238,238,238);color:rgb(88,88);font-family:'微软雅黑';background:rgb(247,247,247);"><p style="margin-bottom:0px;max-width:100%;font-size:15px;">像一个人一样浏览网页,像一台机器一样分析数据<p style="margin-bottom:10px;max-width:100%;font-size:15px;color:rgb(88,255);"><span style="font-weight:700;">接下来我们就讨论一下在整个一系列文章出现的解决方案能突破几种限制(Python2):<blockquote style="padding:10px 20px;margin-bottom:20px;font-size:14px;border-left-width:5px;border-left-style:solid;border-left-color:rgb(238,247);"><p style="margin-bottom:10px;max-width:100%;font-size:15px;">1. Urllib是最弱的web网页浏览模式,User-Agent,cookie,ip都无法解决;<p style="margin-bottom:10px;max-width:100%;font-size:15px;">2. Requests模块与urllib2,urllib3,基本可以解决静态网页的所有问题,但是没办法解决IP限制,如果需要解决IP限制则需要使用代理,如果需要解决验证码问题,则需要自己配置OCR;<p style="margin-bottom:10px;max-width:100%;font-size:15px;">3. Selenium+浏览器:无法解决验证码的问题,效率低,速度慢;<p style="margin-bottom:0px;max-width:100%;font-size:15px;">4. Ghost.py无法解决验证码问题,效率低,速度慢。<p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;"><p style="margin-top:5px;margin-bottom:5px;max-width:100%;color:rgb(0,0);font-family:sans-serif;">
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。