一、识别网站所用技术

构建网站所使用的技术类型也会对我们如何爬取产生影响。有一个十分有用的工具可以检查网站构建的技术类型---builtwith模块。该模块的安装如下

pip install builtwith

该模块将url作为参数,下载该 url 并其进行分析,返回该网站的技术。

>>> import builtwith
>>> builtwith.parse('http://123.127.249.126:8081/manage/login')
{'programming-languages': ['Java'], 'web-servers': ['Nginx'], 'web-frameworks': ['Twitter Bootstrap'], 'javascript-frameworks': ['jQuery']}

从上面返回的结果可以看出,使用的框架是java 的 Twitter Bootstrap(前段框架利器)

二、寻找网站所有者

对于一些网站,我们可能会关心其所有者是谁。比如、我们已知网站的所有者会封禁网络爬虫,那么我们最好把下载速度控制的更加保守一些,为了找到网站所有者,我们可以使用WHOIS 协议查询域名的注册者是谁。Python 中有一个针对该协议的封装库,器文档地址为 https://pypi.python.org/pypi/python-whois,我们可以通过pip进行安装:

pip install python-whois

下面使用该模块对 http://www.baidu.com 进行WHOIS 查询是返回的结果。

>>>import whois
>>> print(whois.whois('http://www.baidu.com'))
{
"domain_name": [
"BAIDU.COM",
"baidu.com"
],
"registrar": "MarkMonitor, Inc.",
"whois_server": "whois.markmonitor.com",
"referral_url": null,
"updated_date": [
"2019-05-09 04:30:46",
"2019-05-08 20:59:33"
],
"creation_date": [
"1999-10-11 11:05:17",
"1999-10-11 04:05:17"
],
"expiration_date": [
"2026-10-11 11:05:17",
"2026-10-11 00:00:00"
],
"name_servers": [
"NS1.BAIDU.COM",
"NS2.BAIDU.COM",
"NS3.BAIDU.COM",
"NS4.BAIDU.COM",
"NS7.BAIDU.COM",
"ns7.baidu.com",
"ns2.baidu.com",
"ns1.baidu.com",
"ns3.baidu.com",
"ns4.baidu.com"
],
"status": [
"clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited",
"clientTransferProhibited https://icann.org/epp#clientTransferProhibited",
"clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited",
"serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited",
"serverTransferProhibited https://icann.org/epp#serverTransferProhibited",
"serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited",
"clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited)",
"clientTransferProhibited (https://www.icann.org/epp#clientTransferProhibited)",
"clientDeleteProhibited (https://www.icann.org/epp#clientDeleteProhibited)",
"serverUpdateProhibited (https://www.icann.org/epp#serverUpdateProhibited)",
"serverTransferProhibited (https://www.icann.org/epp#serverTransferProhibited)",
"serverDeleteProhibited (https://www.icann.org/epp#serverDeleteProhibited)"
],
"emails": [
"abusecomplaints@markmonitor.com",
"whoisrequest@markmonitor.com"
],
"dnssec": "unsigned",
"name": null,
"org": "Beijing Baidu Netcom Science Technology Co., Ltd.",
"address": null,
"city": null,
"state": "Beijing",
"zipcode": null,
"country": "CN"
}

可以看出该域名是 属于百度的,实际上却是如此。

python 网络爬虫(一)的更多相关文章

  1. 关于Python网络爬虫实战笔记③

    Python网络爬虫实战笔记③如何下载韩寒博客文章 Python网络爬虫实战笔记③如何下载韩寒博客文章 target:下载全部的文章 1. 博客列表页面规则 也就是, http://blog.sina ...

  2. 关于Python网络爬虫实战笔记①

    python网络爬虫项目实战笔记①如何下载韩寒的博客文章 python网络爬虫项目实战笔记①如何下载韩寒的博客文章 1. 打开韩寒博客列表页面 http://blog.sina.com.cn/s/ar ...

  3. python 网络爬虫(二) BFS不断抓URL并放到文件中

    上一篇的python 网络爬虫(一) 简单demo 还不能叫爬虫,只能说基础吧,因为它没有自动化抓链接的功能. 本篇追加如下功能: [1]广度优先搜索不断抓URL,直到队列为空 [2]把所有的URL写 ...

  4. python网络爬虫学习笔记

    python网络爬虫学习笔记 By 钟桓 9月 4 2014 更新日期:9月 4 2014 文章文件夹 1. 介绍: 2. 从简单语句中開始: 3. 传送数据给server 4. HTTP头-描写叙述 ...

  5. Python网络爬虫

    http://blog.csdn.net/pi9nc/article/details/9734437 一.网络爬虫的定义 网络爬虫,即Web Spider,是一个很形象的名字. 把互联网比喻成一个蜘蛛 ...

  6. Python 正则表达式 (python网络爬虫)

    昨天 2018 年 01 月 31 日,农历腊月十五日.20:00 左右,152 年一遇的月全食.血月.蓝月将今晚呈现空中,虽然没有看到蓝月亮,血月.月全食也是勉强可以了,还是可以想像一下一瓶蓝月亮洗 ...

  7. Python网络爬虫笔记(五):下载、分析京东P20销售数据

    (一)  分析网页 下载下面这个链接的销售数据 https://item.jd.com/6733026.html#comment 1.      翻页的时候,谷歌F12的Network页签可以看到下面 ...

  8. 如何利用Python网络爬虫抓取微信朋友圈的动态(上)

    今天小编给大家分享一下如何利用Python网络爬虫抓取微信朋友圈的动态信息,实际上如果单独的去爬取朋友圈的话,难度会非常大,因为微信没有提供向网易云音乐这样的API接口,所以很容易找不到门.不过不要慌 ...

  9. 如何利用Python网络爬虫爬取微信朋友圈动态--附代码(下)

    前天给大家分享了如何利用Python网络爬虫爬取微信朋友圈数据的上篇(理论篇),今天给大家分享一下代码实现(实战篇),接着上篇往下继续深入. 一.代码实现 1.修改Scrapy项目中的items.py ...

  10. 【python网络爬虫】之requests相关模块

    python网络爬虫的学习第一步 [python网络爬虫]之0 爬虫与反扒 [python网络爬虫]之一 简单介绍 [python网络爬虫]之二 python uillib库 [python网络爬虫] ...

随机推荐

  1. 洛谷P1616疯狂的采药(完全背包)

    题目背景 此题为NOIP2005普及组第三题的疯狂版. 此题为纪念LiYuxiang而生. 题目描述 LiYuxiang是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师.为此,他想拜附近最有威望的 ...

  2. java 实现一段文字中,出现次数最多的字

    代码如下: public static void main(String[] args) { String str = "大批量,之前都没怎么注意过,这个问题确实不会,网上参考了下别人的,大 ...

  3. 传奇gee引擎,智能假人,假人脚本,geeM2假人

    开新区注意事项: 1.新区无任何玩家数据下可以运行“MirServer\假人行会初始化”目录下的“点我初始化假人行会.Bat”程序 2.默认假人后台管理密码为:2139263   ;--------- ...

  4. VS2017中遇到不存在从string到const char*的转换函数的解决方法

    使用c_str()函数 c_str函数的返回值是const char*. c_str()函数返回一个指向正规C字符串的指针, 内容与本string串相同. 这是为了与c语言兼容,在c语言中没有stri ...

  5. linux +jenkins +python 集成测试

    1.jenkin安装部署 2.git 安装 3.git server 配置 4.contab

  6. 解决IE8不兼容 background-size

    IE8下,使用background-size适应盒子大小时不兼容,效果如下图: 网上找资料,说添加如下代码可以兼容IE8 filter: progid:DXImageTransform.Microso ...

  7. matplotlib显示AttributeError: 'module' object has no attribute 'verbose'

    解决办法:file-settings-tools-python scientific,将show plots in toolwindow前面的对号去掉即可.

  8. Catalyst 2960 重启?

    在实际的网络环境中,交换机的各种问题层出不穷,这里我遇到一个案例.关于Cisco 2960  S 交换机重启的问题. 故障描述:有那么几台C2960S交换机总是随机的重启. 原因:从show ver来 ...

  9. Educational Codeforces Round 82 C. Perfect Keyboard

    Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him ...

  10. 【剑指Offer面试编程题】题目1508:把字符串转换成整数--九度OJ

    题目描述: 将一个字符串转换成一个整数,要求不能使用字符串转换整数的库函数. 输入: 输入可能包含多个测试样例. 对于每个测试案例,输入为一个合法或者非法的字符串,代表一个整数n(1<= n&l ...