用python3爬虫的一些准备工作

发布时间:2019-10-20 09:26:39编辑:auto阅读(3875)

    识别网站所用技术

    python3.6 安装builtwith模块

        import builtwith
    
        builtwith.parse('https://ggstudy.herokuapp.com/')
    

    寻找网站所有者

    pip install python-whois
    
    import whois
    
    whois.whois('https://ggstudy.herokuapp.com')
    

    ----------

    下载网页

    import urllib.request
    
    urllib.request.urlopen(url).read().decode('utf-8')
    

    查询域名是否被注册

    import urllib.request
    
    req= urllib.request.urlopen('http://panda.www.net.cn/cgi-bin/check.cgi?area_domain=ggstudy.herokuapp.com')
    
    print(req.read().decode('utf-8'))
    

    网页解析

    python2为 urlparse

    import urllib.parse
    

关键字