From 8ea14b8c6bd740bfc69bd4a65eadd7eb3916b48a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 14 Nov 2019 12:13:59 +0100 Subject: index.php: extract date from recovered news --- index.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index f0405a4..370fe5a 100644 --- a/index.php +++ b/index.php @@ -107,9 +107,16 @@ if ($news32 === false) { print " \n"; } else { foreach($news32 -> {'entry'} as $entry) { + $content = $entry -> {'summary'} -> __toString(); + if (preg_match('#^

By [^<]*
On ([0-9]+)/([0-9]+)/([0-9]+), [^<]+

.*$#', $content) == false) + $date = explode('T', $entry -> {'updated'} -> __toString())[0]; + else { + $date = preg_replace('#^

By [^<]*
On ([0-9]+)/([0-9]+)/([0-9]+), [^<]+

.*$#', '\3-\1-\2', $content); + $content = preg_replace('#^

By [^<]*
On [^<]*

#', '', $content); + } $news[] = array ( - 'content' => preg_replace('#^

By [^<]*
On [^<]*

#', '', $entry -> {'summary'} -> __toString()), - 'date' => explode('T', $entry -> {'updated'} -> __toString())[0], + 'content' => $content, + 'date' => $date, 'link' => $entry -> {'link'} -> attributes() -> {'href'} -> __toString(), 'title' => $entry -> {'title'} -> __toString() ); -- cgit v1.2.3-70-g09d2