一、识别网站所用技术

构建网站所使用的技术类型也会对我们如何爬取产生影响。有一个十分有用的工具可以检查网站构建的技术类型---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. Android学习08

    PopupWindow PopupWindow用来实现一个弹出框,可以使用任意布局的View作为其内容,这个弹出框是悬浮在当前activity之上的. 1.弹出框的布局:画一个PopupWindow的 ...

  2. H2知识小结

    1.官网: http://www.h2database.com/html/main.html file:///E:/Develop/H2/docs/html/tutorial.html#web_app ...

  3. Codeforces Round #601 (Div. 2)D(蛇形模拟)

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; vector<char>an ...

  4. Java编译器的常量优化

    /* 在给变量进行赋值的时候,如果右侧的表达式当中全都是常量,没有任何变量, 那么编译器javac将会直接将若干个常量表达式计算得到结果. short result = 5 + 8; // 等号右边全 ...

  5. Uva 11300 Spreading the Wealth(贪心)

    题目链接:https://vjudge.net/problem/UVA-11300 这道题的思路太神了,但很难想到是贪心. 用M表示每个人最终拥有的金币数. 首先假设有四个人.假设1号给2号3枚,2号 ...

  6. linux python3编译以及 卸载,python默认为python3 ,pip默认为pip3,亲测版

    前置准备yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-de ...

  7. 【笔记8-Redis分布式锁】从0开始 独立完成企业级Java电商网站开发(服务端)

    Redis分布式锁 Redis分布式锁命令 setnx当且仅当 key 不存在.若给定的 key 已经存在,则 setnx不做任何动作.setnx 是『set if not exists』(如果不存在 ...

  8. 记C++中发现的隐式转换问题

    #include <iostream> #include <string> using std::cin; using std::cout; using std::endl; ...

  9. 【原】python总结

    python3浅拷贝和深拷贝:https://www.jianshu.com/p/c7e72fcad407

  10. 19市赛 树状数组 第k个小的糖果

    int find_kth(int k) { , cnt = , i; ; i >= ; i--)/ { ans += ( << i); if (ans >= maxn|| cn ...