eduardorengifo/botnews
Composer 安装命令:
composer require eduardorengifo/botnews
包简介
Bot News
README 文档
README
Botnews is a small PHP script to extract news from websites.
Installation
To install, use the following to pull the package in via Composer.
$ composer require eduardorengifo/botnews
Configuration
At the moment there are only two news sites configured. The same settings could be applied for all other available sites.
require_once __DIR__ . '/vendor/autoload.php'; $rppPostSlug = 'futbol/seleccion-peruana/video-ricardo-gareca-para-rpp-tenemos-que-tener-los-pies-sobre-la-tierra-en-el-mundial-noticia-1096914'; $rpp = new \BotNews\Sites\Rpp(); /** @var \BotNews\Models\Post $rppPost */ $rppPost = $rpp->getPost( $rppPostSlug ); /** @var \BotNews\Models\Page $rppPage */ $rppPage = $rpp->getPage('futbol');
Extend
To set up your own news site using the classes, models and BotNews interface you could use the following template.
use BotNews\BotNews; use BotNews\Client; class SiteName extends Client implements BotNews { /** * @var string */ protected $siteUrl = ''; // TODO: Place the web site url /** * @param string $slug * * @return Post */ public function getPost( $slug ) { // TODO: Your code configuration for post }; /** * @param mixed $paged * * @return Page */ public function getPage( $paged = 1 ) { // TODO: Your code configuration for page }; }
License
BotNews is open-sourced software licensed under the MIT license
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-30