From 23cb9349fccd2c7342a4ddeac600d39ea0e4c787 Mon Sep 17 00:00:00 2001
From: Tomasz Molski <41341072+KappaPrajd@users.noreply.github.com>
Date: Sun, 23 Mar 2025 21:30:45 +0100
Subject: [PATCH] [CeskaTelevizeBridge] Adjusted getting article timestamp
(#4486)
* [CeskaTelevizeBridge] Adjusted getting article timestamp
* [CeskaTelevizeBridge] Removed excess whitespace
---
bridges/CeskaTelevizeBridge.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/bridges/CeskaTelevizeBridge.php b/bridges/CeskaTelevizeBridge.php
index a996bd11..f1ed4487 100644
--- a/bridges/CeskaTelevizeBridge.php
+++ b/bridges/CeskaTelevizeBridge.php
@@ -41,11 +41,15 @@ class CeskaTelevizeBridge extends BridgeAbstract
foreach ($html->find('#episodeListSection a[data-testid=card]') as $element) {
$itemContent = $element->find('p[class^=content-]', 0);
$itemDate = $element->find('div[class^=playTime-] span, [data-testid=episode-item-broadcast] span', 0);
+
+ // Remove special characters and whitespace
+ $cleanDate = preg_replace('/[^0-9.]/', '', $itemDate->plaintext);
+
$item = [
'title' => $this->fixChars($element->find('h3', 0)->plaintext),
'uri' => self::URI . $element->getAttribute('href'),
'content' => '->getAttribute('srcset') . ')
' . $this->fixChars($itemContent->plaintext),
- 'timestamp' => $this->getUploadTimeFromString($itemDate->plaintext),
+ 'timestamp' => $this->getUploadTimeFromString($cleanDate),
];
$this->items[] = $item;
@@ -58,7 +62,7 @@ class CeskaTelevizeBridge extends BridgeAbstract
return strtotime('today');
} elseif (strpos($string, 'včera') !== false) {
return strtotime('yesterday');
- } elseif (!preg_match('/(\d+).\s(\d+).(\s(\d+))?/', $string, $match)) {
+ } elseif (!preg_match('/(\d+).(\d+).((\d+))?/', $string, $match)) {
returnServerError('Could not get date from Česká televize string');
}