[Webfail] Extract timestamp from element (#1852)

Works only for German language.
This commit is contained in:
KN4CK3R 2022-03-29 20:46:55 +02:00 committed by GitHub
parent 6d4155f995
commit a746987d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,6 +84,16 @@ class WebfailBridge extends BridgeAbstract {
$description = $element->find('div.wf-news-description', 0)->innertext;
}
$infoElement = $element->find('div.wf-small', 0);
if (!is_null($infoElement)) {
if (preg_match('/(\d{2}\.\d{2}\.\d{4})/m', $infoElement->innertext, $matches) === 1 && count($matches) == 2) {
$dt = DateTime::createFromFormat('!d.m.Y', $matches[1]);
if ($dt !== false) {
$item['timestamp'] = $dt->getTimestamp();
}
}
}
$item['content'] = '<p>'
. $description
. '</p><br><a href="'