Skip to content

📰 🎉 Botnews is a small PHP script to extract news from websites.

License

Notifications You must be signed in to change notification settings

eduardorengifo/botnews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BotNews

Build Status License: MIT Packagist Pre Release PHP from Packagist

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

About

📰 🎉 Botnews is a small PHP script to extract news from websites.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages