pforret/pf-article-extractor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pforret/pf-article-extractor

最新稳定版本:0.3.3

Composer 安装命令:

composer require pforret/pf-article-extractor

包简介

PfArticleExtractor. Boilerplate Removal and Fulltext Extraction from HTML pages

README 文档

README

Tests GitHub Release GitHub Tag GitHub commit activity Packagist Downloads PHP GitHub License

Boilerplate Removal and Fulltext Extraction from HTML pages.

Rewrite of dotpack/php-boiler-pipe for PHP8.2 and up, with tests.

Installation

composer require pforret/pf-article-extractor

Usage

use Pforret\PfArticleExtractor\ArticleExtractor;

$articleData = ArticleExtractor::getArticle($html);
/*
 * $articleData = Pforret\PfArticleExtractor\Formats\ArticleContentsDTO Object
(
    [title] => Film Podcast: Wicked Little Letters Named Film of the Month
    [content] => UK Film Club was back in March with a new episode of their film podcast. (...)
    [date] =>
    [images] => Array
        (
            [0] => https://static.wixstatic.com/media/.../b19cd0_dde0d59546f84127865267f43994f39b~mv2.jpg
        )

    [links] => Array
        (
            [0] => https://www.chrisolson.co.uk/
            (...)
        )

)

 */

Under the hood

  • package accepts a full HTML page as input
  • it will walk the DOM tree and try to find the main article content
  • it will remove boilerplate content (like headers, footers, sidebars, ...)
  • it will try to extract the main article content
  • it will try to extract the title, date, images and links from the article

Rights now it's tested with example pages for

  • Blogger
  • Drupal
  • Jekyll
  • Mkdocs
  • Wix
  • WordPress

Similar packages

统计信息

  • 总下载量: 1.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 12
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-02