innmind/robots-txt
Composer 安装命令:
composer require innmind/robots-txt
包简介
Robots.txt parser
README 文档
README
Robots.txt parser
Installation
composer require innmind/robots-txt
Usage
use Innmind\RobotsTxt\Parser; use Innmind\OperatingSystem\Factory; use Innmind\Url\Url; $os = Factory::build(); $parse = Parser::of( $os->remote()->http(), 'My user agent', ); $robots = $parse(Url::of('https://github.com/robots.txt'))->match( static fn($robots) => $robots, static fn() => throw new \RuntimeException('robots.txt not found'), ); $robots->disallows('My user agent', Url::of('/humans.txt')); //false $robots->disallows('My user agent', Url::of('/any/other/url')); //true
Note
Here only the path /humans.txt is allowed because by default github disallows any user agent to crawl there website except for this file.
统计信息
- 总下载量: 424
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-01