Giter Club home page Giter Club logo

pyloom's Introduction

PyLoom,爬龙!

PyLoom想为有价值的网站编写爬虫,让开发者便捷地获取结构化的数据。

PyLoom由三个部分组成,

  1. 框架,减少编写、运行、维护爬虫的工作量。

  2. 爬虫,寻找有价值的目标为其开发爬虫,并维护既有爬虫的可用性。

    预期19年底,PyLoom将拥有围绕电子商务、房屋租售、社交网络、新闻媒体的数十个爬虫。

  3. 升级爬虫,对于频繁使用的爬虫,增强其能力

    • 增强定制能力,例如支持限定地区、类别、关键字抓取;
    • 增强抓取策略,减少对代理、打码接口的使用;
    • 增强更新策略,更细粒度地计算重复抓取的时间。

目前进度,

①部分完成,开发常见爬虫够用了,随爬虫的开发迭代出更多功能;

②已有几款爬虫,放置于spiders目录。

安装

  1. 环境要求

    • python 3.6.0+
    • redis 2.6+
    • 类unix系统
  2. 安装PyLoom

    git clone https://github.com/spencer404/PyLoom.git
    python3.6 -m pip install -e ./PyLoom

    添加 -i https://pypi.douban.com/simple 参数,利用豆瓣镜像提速。

    出现错误fatal error: Python.h: No such file or directory时,

    需安装对应平台的python3.x-devel包

运行

以运行spiders/WeiBo为例,

  1. 最简参数启动爬虫

    pyloom run -s PyLoom/spiders/WeiBo

    在爬虫目录中执行run时,可省略-s参数。

  2. 启动代理池

    pyloom proxy run
  3. 添加代理

    根据命令提示,添加名为"xxx"的代理

    pyloom proxy add
  4. 使用代理启动爬虫

    pyloom run --proxy xxx

    命令run的部分常用参数:

    -l, --level    日志级别
    -s, --spider   指定爬虫目录
    -r, --redis    指定redis地址(URL形式)
    -C, --clear    清空队列、代理数据后运行
    --proxy        使用指定代理运行,逗号分隔多个代理
    --damon        作为守护进程运行
    -p             子进程数量
    -t             每个子进程的线程数量

    在多台服务器上运行时,若参数-s、-r所指向的目标相同,即可横向扩容性能。

    默认地,PyLoom将抓到数据打印在日志中,你可以修改on_save函数自定义如何保存。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.