fedi-feed-router/bin/check-and-post

21 lines
No EOL
506 B
PHP

#!/usr/bin/env php
<?php
require __DIR__ . '/../bootstrap/autoload.php';
use Feddev\LemmyArticlePoster\Domain\Articles\ArticleFetcher;
$articles = ArticleFetcher::getNewArticles();
$newArticles = $articles->filter(function($article) {
return $article->wasRecentlyCreated;
});
echo "Found " . $articles->count() . " articles (" . $newArticles->count() . " new)\n";
$newArticles->each(function($article) {
echo "New article: " . $article->url . "\n";
// $article->publish();
});
echo "\n";