Coder Social home page Coder Social logo

fastspider_doc's Introduction

fastspider

简介

fastspider 是一款上手非常简单的爬虫框架, 在很多设计上参考scrapy框架, 相比scrapy更加轻便与上手。 目前fastspider框架功能正在逐渐的完善中, fastspider内置多种爬虫, 如下:

  • LightSpider 轻量级爬虫, 上手非常简答。基于内存队列进行任务处理, 适合于爬取数据量少的场景, 不支持断点续爬, 不支持分布式。

在线文档

环境要求

  • Python 3.8.0+
  • Works on Linux, Windows, macOS

安装

From PyPi:

pip3 install fastspider

小试一下

创建爬虫

fastspider startspider -s hello_spider 1/2

创建后的爬虫代码如下:

# encoding=utf-8

import fastspider


class HelloSpider(fastspider.LightSpider):

    start_urls = ["http://www.baidu.com"]

    def start_requests(self):
        for url in self.start_urls:
            yield fastspider.Request(url)

    def parser(self, request, response):
        print(response)


if __name__ == "__main__":
    HelloSpider().start()

直接运行,打印如下:

<Response [200]>
无任务, 爬虫执行完毕

代码解释如下:

  1. start_requests: 生产任务
  2. parser: 解析器, 用于解析响应response

fastspider_doc's People

Contributors

coco369 avatar

Watchers

 avatar

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.