当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
53 Star 201 Fork 49

Kiddyu / Beanbun
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Build Status License Sauce Test Status

简介

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

文档

https://github.com/kiddyuchina/Beanbun/blob/master/docs/chs/README.md

广告

推荐一下最近发现的一个很好用的全球代理:SmartProxy
专业海外http代理商,有1亿真实住宅IP资源,覆盖全球,高匿稳定提供100%原生住宅IP,支持社交账户、电商平台、网络数据收集等服务。
匿名性很好,伪装度很高,IP限制问题轻松解决。
本人测试用过之后感觉很不错。
现春季价格优惠,动态住宅代理只要65折!

特点

  • 支持守护进程与普通两种模式(守护进程模式只支持 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

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

插件

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

MIT License Copyright (c) 2017 kiddyuchina Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Beanbun 是用 PHP 编写的多进程网络爬虫框架,支持分布式,具有良好的开放性、高可扩展性,基于 Workerman。 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/kidd_yu/beanbun.git
git@gitee.com:kidd_yu/beanbun.git
kidd_yu
beanbun
Beanbun
master

搜索帮助