2016-08-19 04:33:58 +02:00
|
|
|
<?php
|
|
|
|
|
2016-08-25 03:17:58 +02:00
|
|
|
namespace Miniflux\Handler\Scraper;
|
2016-08-19 04:33:58 +02:00
|
|
|
|
|
|
|
use PicoFeed\Scraper\Scraper;
|
2016-08-25 03:17:58 +02:00
|
|
|
use Miniflux\Model\Config;
|
2016-08-19 04:33:58 +02:00
|
|
|
|
|
|
|
function download_contents($url)
|
|
|
|
{
|
|
|
|
$contents = '';
|
|
|
|
|
|
|
|
$scraper = new Scraper(Config\get_reader_config());
|
|
|
|
$scraper->setUrl($url);
|
|
|
|
$scraper->execute();
|
|
|
|
|
|
|
|
if ($scraper->hasRelevantContent()) {
|
|
|
|
$contents = $scraper->getFilteredContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $contents;
|
|
|
|
}
|