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-12-26 15:44:53 +01:00
|
|
|
use Miniflux\Handler;
|
2016-08-19 04:33:58 +02:00
|
|
|
|
2016-12-26 15:44:53 +01:00
|
|
|
function download_content($url)
|
2016-08-19 04:33:58 +02:00
|
|
|
{
|
|
|
|
$contents = '';
|
|
|
|
|
2016-12-26 15:44:53 +01:00
|
|
|
$scraper = new Scraper(Handler\Feed\get_reader_config());
|
2016-08-19 04:33:58 +02:00
|
|
|
$scraper->setUrl($url);
|
|
|
|
$scraper->execute();
|
|
|
|
|
|
|
|
if ($scraper->hasRelevantContent()) {
|
|
|
|
$contents = $scraper->getFilteredContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $contents;
|
|
|
|
}
|