zoukankan      html  css  js  c++  java
  • scrapy

    安装

    #Windows平台
        1、pip3 install wheel #安装后,便支持通过wheel文件安装软件,wheel文件官网:https://www.lfd.uci.edu/~gohlke/pythonlibs  第三方安装包是.whl文件,所以需要安装此wheel包  .whl第三方包安装方法: pip install xxx.whl
        3、pip3 install lxml
        4、pip3 install pyopenssl
        5、下载并安装pywin32:https://sourceforge.net/projects/pywin32/files/pywin32/  # 也可以直接使用pip install pywin32安装
        6、下载twisted的wheel文件:http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
        7、执行pip3 install 下载目录Twisted-17.9.0-cp36-cp36m-win_amd64.whl
        8、pip3 install scrapy
      
    #Linux平台
        1、pip3 install scrapy

     命令行工具

    #1 查看帮助
        scrapy -h
        scrapy <command> -h
    
    #2 有两种命令:其中Project-only必须切到项目文件夹下才能执行,而Global的命令则不需要
        Global commands:
            startproject #创建项目
            genspider    #创建爬虫程序,需要切换到项目文件夹下  # 如: scrapy genspider baidu www.baidu.com
            settings     #如果是在项目目录下,则得到的是该项目的配置
            runspider    #运行一个独立的python文件,不必创建项目
            shell        #scrapy shell url地址  在交互式调试,如选择器规则正确与否
            fetch        #独立于程单纯地爬取一个页面,可以拿到请求头
            view         #下载完毕后直接弹出浏览器,以此可以分辨出哪些数据是ajax请求
            version      #scrapy version 查看scrapy的版本,scrapy version -v查看scrapy依赖库的版本
        Project-only commands:
            crawl        #运行爬虫,必须创建项目才行,确保配置文件中ROBOTSTXT_OBEY = False
            check        #检测项目中有无语法错误
            list         #列出项目中所包含的爬虫名
            edit         #编辑器,一般不用
            parse        #scrapy parse url地址 --callback 回调函数  #以此可以验证我们的回调函数是否正确
            bench        #scrapy bentch压力测试
    
    #3 官网链接
        https://docs.scrapy.org/en/latest/topics/commands.html
  • 相关阅读:
    jq 编写弹窗
    jq 编写选项卡
    event 事件 自定义滚动条 控制文字滚动
    Integer Partition Algorithm
    Implement the integral part logn base 2 with bit manipulations
    **Nim Game hard hard version
    *Check whether a given graph is Bipartite or not
    *Flatten a multilevel linked list
    Priority Queue Implementation
    Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted
  • 原文地址:https://www.cnblogs.com/zhouze/p/11535547.html
Copyright © 2011-2022 走看看