diff --git a/parser.php b/parser.php index fd0699b..389424f 100644 --- a/parser.php +++ b/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 "* «".$title."» — $author
$description\n"; +function printGame($url, $title, $author, $description = '') { + echo "
  • «".$title."» — $author"; + if ($description) { + echo "
    $description"; + } + echo "
  • \n"; } echo "

    Apero

    \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);