netflex/scraper

此包已被废弃,不再维护。未建议替代包。

元数据抓取库

v1.0.0 2021-01-08 22:53 UTC

This package is auto-updated.

Last update: 2021-11-19 12:53:58 UTC


README

用于抓取网站元数据的PHP库

安装

composer require netflex/scraper

与Netflex SDK一起使用

<?php

use Scraper;

$metadata = Scraper::scrape('https://example.com');

echo $metadata->site;        // "example.com"
echo $metadata->title;       // "Example Domain"
echo $metadata->description; // "This domain is for use in illustrative examples in documents. You may use this    domain in literature without prior coordination or asking for permission."
echo $metadata->canonical;   // "https:\/\/example.com"

独立使用

<?php

use Netflex\Scraper\Scraper;

$scraper = new Scraper();

$metadata = $scraper->scrape('https://example.com');

元数据字段

字段 描述
hash 唯一标识此抓取的哈希值
language 文档的语言代码
site 文档的域名
title 文档的标题
image 文档的主要图像
description 文档的描述
keywords 描述文档的关键词数组
canonical 文档的规范URL
icon 文档的图标或favicon
author 文档的作者
copyright 文档的版权字符串
amphtml 此文档的AMP版本
scraped 执行此抓取的日期和时间