{"id":15374306,"url":"https://github.com/yurunsoft/yurun-crawler","last_synced_at":"2025-04-15T11:33:04.465Z","repository":{"id":46962002,"uuid":"274118844","full_name":"Yurunsoft/yurun-crawler","owner":"Yurunsoft","description":"宇润爬虫框架(Yurun Crawler) 是一个低代码、高性能、分布式爬虫采集框架，基于 imi 框架开发，运行在 Swoole 常驻内存的协程环境。","archived":false,"fork":false,"pushed_at":"2020-11-04T02:21:37.000Z","size":174,"stargazers_count":39,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T10:51:24.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yurunsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-22T11:28:57.000Z","updated_at":"2024-06-24T09:05:39.000Z","dependencies_parsed_at":"2022-09-22T14:24:57.110Z","dependency_job_id":null,"html_url":"https://github.com/Yurunsoft/yurun-crawler","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fyurun-crawler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fyurun-crawler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fyurun-crawler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yurunsoft%2Fyurun-crawler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yurunsoft","download_url":"https://codeload.github.com/Yurunsoft/yurun-crawler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223673050,"owners_count":17183618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T13:58:18.171Z","updated_at":"2024-11-08T11:03:17.549Z","avatar_url":"https://github.com/Yurunsoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yurun-crawler\r\n\r\n[![Latest Version](https://img.shields.io/packagist/v/yurunsoft/crawler.svg)](https://packagist.org/packages/yurunsoft/crawler)\r\n[![Travis](https://img.shields.io/travis/Yurunsoft/yurun-crawler.svg)](https://travis-ci.org/github/Yurunsoft/yurun-crawler)\r\n[![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg)](https://secure.php.net/)\r\n[![Swoole Version](https://img.shields.io/badge/swoole-%3E=4.3.0-brightgreen.svg)](https://github.com/swoole/swoole-src)\r\n[![imi Doc](https://img.shields.io/badge/docs-passing-green.svg)](https://doc.imiphp.com)\r\n[![imi License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/Yurunsoft/crawler/blob/master/LICENSE)\r\n\r\n## 介绍\r\n\r\n宇润爬虫框架(Yurun Crawler) 是一个低代码、高性能、分布式爬虫采集框架，这可能是最一把梭的爬虫框架。\r\n\r\nYurun Crawler 基于 imi 框架开发，运行在 Swoole 常驻内存的协程环境。\r\n\r\n为什么会开发这个框架？遇上有爬虫相关需求，调研了一些市面上现有的 PHP 爬虫框架，甚至是其它语言的爬虫框架，功能都十分简陋，需要编写的重复代码极多，不够一把梭。\r\n\r\n**开发手册：**\u003chttps://doc.yurunsoft.com/yurun-crawler/\u003e\r\n\r\n### 目标\r\n\r\n能够用最少的代码，方便快速地实现爬虫采集功能。\r\n\r\n### 愿景\r\n\r\n成为宇宙第一爬虫框架，以后提到爬虫就想到 Yurun Crawler 可以一把梭实现！\r\n\r\n## 功能特性\r\n\r\n* **低代码**，几乎不需要编写代码，大部分逻辑依靠注解实现\r\n* **高性能**，基于 [imi](https://www.imiphp.com/) + [Swoole](https://www.swoole.com/) 常驻内存及协程实现。即便只开一个下载器进程，也足以支撑大量的并发下载任务。\r\n* **分布式**，采集的流程由消息队列推动，依靠 Redis 等中间件实现纯天然的分布式特性\r\n* 支持下载器并发**限流**\r\n* 内置解析能力强，支持：**Dom 解析、正则、JSON、Chrome Headless 页面渲染采集**\r\n* **代理 IP 池**，支持：MySQL、Redis\r\n* 支持**定时采集**\r\n* 支持**模型存储**\r\n* 方便扩展\r\n\r\n## 示例\r\n\r\n**Demo Example:** \u003chttps://github.com/Yurunsoft/yurun-crawler-example\u003e\r\n\r\n主要采集逻辑，可通过注解的方式来编写，超级简单：\r\n\r\n```php\r\n\u003c?php\r\nnamespace Yurun\\CrawlerApp\\Module\\YurunBlog\\Article\\Model;\r\n\r\nuse Yurun\\Crawler\\Module\\Parser\\Annotation\\DomSelect;\r\nuse Yurun\\Crawler\\Module\\Parser\\Enum\\DomSelectMethod;\r\nuse Yurun\\Crawler\\Module\\DataModel\\Contract\\BaseDataModel;\r\n\r\n/**\r\n * 文章内容模型\r\n */\r\nclass ArticleModel extends BaseDataModel\r\n{\r\n    /**\r\n     * 标题\r\n     * \r\n     * @DomSelect(selector=\".article-view h1\", method=DomSelectMethod::TEXT)\r\n     *\r\n     * @var string\r\n     */\r\n    public $title;\r\n\r\n    /**\r\n     * 内容\r\n     *\r\n     * @DomSelect(selector=\".article-content\", method=DomSelectMethod::HTML)\r\n     * \r\n     * @var string\r\n     */\r\n    public $content;\r\n\r\n    /**\r\n     * 时间\r\n     *\r\n     * @DomSelect(selector=\".article-info .time\", method=DomSelectMethod::TEXT)\r\n     *\r\n     * @var string\r\n     */\r\n    public $time;\r\n\r\n}\r\n```\r\n\r\n## 概念\r\n\r\n### 采集项目\r\n\r\n有时候，我们会先采集列表页，再采集内容页\r\n\r\n列表页、内容页，都是采集项目，他们的下载、解析、处理逻辑可能都不相同\r\n\r\n### 下载器\r\n\r\n负责请求网址，下载并存储内容。\r\n\r\n多协程的架构下，支持同时下载海量数据。\r\n\r\n支持限流。\r\n\r\n### 数据模型\r\n\r\n定义需要从页面中，提取的内容属性。\r\n\r\n### 解析器\r\n\r\n负责解析下载后的内容，从中提取需要的信息，返回数据模型。\r\n\r\n支持：Dom 解析、正则、JSON、Chrome Headless 页面渲染采集。\r\n\r\n### 处理器\r\n\r\n解析器解析出数据模型后，交由处理器进行处理。\r\n\r\n### 存储器\r\n\r\n负责将解析后的数据存储入库，支持多种存储方式，并且可以自由扩展。\r\n\r\n### 代理 IP 池\r\n\r\n实现代理 IP 池抽象，开发者可以很方便地对接不同接口方。\r\n\r\n## 联系我们\r\n\r\n免费技术支持、交流群：17916227 [![点击加群](https://pub.idqqimg.com/wpa/images/group.png \"点击加群\")](https://jq.qq.com/?_wv=1027\u0026k=5wXf4Zq)\r\n\r\n商业合作 QQ：369124067\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyurunsoft%2Fyurun-crawler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyurunsoft%2Fyurun-crawler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyurunsoft%2Fyurun-crawler/lists"}