Coder Social home page Coder Social logo

hezll / beanbun Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kiddyuchina/beanbun

0.0 2.0 0.0 65 KB

Beanbun 是用 PHP 编写的多进程网络爬虫框架,具有良好的开放性、高可扩展性,基于 Workerman。

Home Page: http://www.beanbun.org

License: MIT License

PHP 100.00%

beanbun's Introduction

Build Status License Sauce Test Status

简介

Beanbun 是一个简单可扩展的爬虫框架,支持分布式,支持守护进程模式与普通模式,守护进程模式基于 Workerman,下载器基于 Guzzle

特点

  • 支持守护进程与普通两种模式(守护进程模式只支持 Linux 服务器)
  • 默认使用 guzzle 进行爬取
  • 支持分布式
  • 支持内存、Redis 等多种队列方式
  • 支持自定义URI过滤
  • 支持广度优先和深度优先两种爬取方式
  • 遵循 PSR-4 标准
  • 爬取网页分为多步,每步均支持自定义动作(如添加代理、修改 user-agent 等)
  • 灵活的扩展机制,可方便的为框架制作插件:自定义队列、自定义爬取方式...

安装

Beanbun 可以通过 composer 进行安装。

$ composer require kiddyu/beanbun

快速开始

创建一个文件 start.php,包含以下内容

<?php
use Beanbun\Beanbun;
$beanbun = new Beanbun;
$beanbun->seed = [
	'http://www.950d.com/',
	'http://www.950d.com/list-1.html',
	'http://www.950d.com/list-2.html',
];
$beanbun->afterDownloadPage = function($beanbun) {
	file_put_contents(__DIR__ . '/' . md5($beanbun->url), $beanbun->page);
};
$beanbun->start();

在命令行中执行

$ php start.php

接下来就可以看到抓取的日志了。

插件

更多详细内容,请查看 文档

beanbun's People

Contributors

iangely avatar kiddyuchina avatar

Watchers

 avatar  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.