2016-08-18 22:33:58 -04:00
|
|
|
<?php
|
|
|
|
|
2016-08-24 21:17:58 -04:00
|
|
|
namespace Miniflux\Handler\Scraper;
|
2016-08-18 22:33:58 -04:00
|
|
|
|
|
|
|
use PicoFeed\Scraper\Scraper;
|
2016-12-26 09:44:53 -05:00
|
|
|
use Miniflux\Handler;
|
2016-08-18 22:33:58 -04:00
|
|
|
|
2016-12-26 09:44:53 -05:00
|
|
|
function download_content($url)
|
2016-08-18 22:33:58 -04:00
|
|
|
{
|
|
|
|
$contents = '';
|
|
|
|
|
2016-12-26 09:44:53 -05:00
|
|
|
$scraper = new Scraper(Handler\Feed\get_reader_config());
|
2016-08-18 22:33:58 -04:00
|
|
|
$scraper->setUrl($url);
|
|
|
|
$scraper->execute();
|
|
|
|
|
|
|
|
if ($scraper->hasRelevantContent()) {
|
|
|
|
$contents = $scraper->getFilteredContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $contents;
|
|
|
|
}
|