stajor / readability
Mozilla Readability PHP 桥接库
1.2.1
2020-10-12 18:27 UTC
Requires
- php: >=7.4
- ext-json: *
- ext-pcntl: *
- symfony/process: ^5.1
Requires (Dev)
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2024-09-13 05:10:33 UTC
README
要求和安装
此包需要 PHP >= 7.1 和 Node >= 10。
安装
$ composer require stajor/readability
$ npm install @mozilla/readability
$ npm install jsdom
使用方法
<?php $html = "<body>Here's a bunch of text</body>"; $url = 'https://www.example.com/the-page-i-got-the-source-from'; $readability = new Readability\Readability($html, $url); $article = $readability->parse(); $article->title(); // article title $article->author(); // author metadata $article->dir(); // content direction $article->content(); // HTML string of processed article content $article->text(); // Text string of processed article content $article->length(); // length of an article, in characters
贡献
欢迎在 GitHub 上提交错误报告和拉取请求:https://github.com/Stajor/readability。本项目旨在为协作提供一个安全、欢迎的空间,贡献者应遵守贡献者公约。
许可协议
该库在MIT 许可协议下以开源形式提供。