jinas/saturn

Saturn 解析器可以从您提供的任何URL中提取人类关心的信息

v1.0.3 2019-10-26 20:20 UTC

This package is auto-updated.

Last update: 2024-09-13 16:07:38 UTC


README

Latest Stable Version License

Image description

Saturn 解析器是一个composer包,可以从您提供的任何URL中提取人类关心的信息,例如文章内容、标题、作者、发布日期、摘要、封面图片等。

演示应用 Saturn 演示

安装

  • 命令
composer require jinas/saturn

用法

  • 代码示例
<?php

namespace Jinas\Saturn;

require '../vendor/autoload.php';

$rp = new Saturn;

echo $rp->parse('https://www.cnet.com/reviews/google-nest-mini-review/');
{
    "success": true,
    "data": {
        "title": "Google Nest Mini review: Google's smallest smart speaker keeps getting better - CNET",
        "un_title": "Google Nest Mini review:\u00a0Google's smallest smart speaker keeps getting better",
        "lead_image": "https://cnet3.cbsistatic.com/img/BSH2-_S4lmkYNase8GgaOJvCkaY=/2019/10/09/c07227f1-9255-48db-8bee-1a4851ee5fcf/google-home-nest-mini-1529.jpg",
        "date_published": "2019-10-17T05:00:00-0700",
        "description": "Better sound, better listening and better controls pack a punch in Google's pint-size smart speaker. Oh, and it comes in blue now.",
        "keywords": null,
        "url": "https://www.cnet.com/reviews/google-nest-mini-review/",
        "word_count": 22,
        "domain": "www.cnet.com",
        "site_name": "CNET"
    },
    "message": "Data extracted successfuly :)"
}

源代码