Фикс вывода
This commit is contained in:
parent
60fb0f857f
commit
efeeb0aa70
11
parser.php
11
parser.php
|
@ -6,8 +6,12 @@ $dom = new Dom;
|
|||
$period = strtotime("1 week ago");
|
||||
$formatter = new IntlDateFormatter( 'ru', IntlDateFormatter::LONG, IntlDateFormatter::NONE );
|
||||
|
||||
function printGame($url, $title, $author, $description) {
|
||||
echo "* <a href='$url'>«".$title."»</a> — $author<br>$description\n";
|
||||
function printGame($url, $title, $author, $description = '') {
|
||||
echo "<li><a href='$url'>«".$title."»</a> — $author";
|
||||
if ($description) {
|
||||
echo "<br>$description";
|
||||
}
|
||||
echo "</li>\n";
|
||||
}
|
||||
|
||||
echo "<h4> Apero </h4>\n";
|
||||
|
@ -30,7 +34,8 @@ function insteadfeed($url) {
|
|||
$games = $dom->find('.game');
|
||||
foreach ($games as $game) {
|
||||
$date = trim($game->find('.b .date b')->innerHtml);
|
||||
$date = $formatter->parse($date);
|
||||
$date = DateTime::createFromFormat('Y.m.d', $date);
|
||||
$date = $date->format('U');
|
||||
if ($date < $period) continue;
|
||||
$author = str_replace(trim($game->find('span.author')->innerHtml), 'Автор: ', '');
|
||||
$title = trim($game->find('h2')[0]->find('a')[0]->innerHtml);
|
||||
|
|
Reference in a new issue