diff --git a/bridges/JornalNBridge.php b/bridges/JornalNBridge.php
index 89381062..7eadc025 100644
--- a/bridges/JornalNBridge.php
+++ b/bridges/JornalNBridge.php
@@ -75,15 +75,16 @@ class JornalNBridge extends BridgeAbstract
$image = $article->find('.elementor-post__thumbnail img', 0)->src;
//Timestamp
$date = $article->find('.elementor-post-date', 0)->plaintext;
+ $date = trim($date, "\t ");
$date = preg_replace('/ de /i', '/', $date);
$date = preg_replace('/, /', '/', $date);
$date = explode('/', $date);
- $year = $date[2];
- $month = $date[1];
- $day = $date[0];
+ $year = (int) $date[2];
+ $month = (int) $date[1];
+ $day = (int) $date[0];
foreach (self::PT_MONTH_NAMES as $key => $item) {
if ($key === strtolower($month)) {
- $month = $item;
+ $month = (int) $item;
}
}
$timestamp = mktime(0, 0, 0, $month, $day, $year);
diff --git a/bridges/ReutersBridge.php b/bridges/ReutersBridge.php
index ab2e812d..63c838c2 100644
--- a/bridges/ReutersBridge.php
+++ b/bridges/ReutersBridge.php
@@ -342,15 +342,12 @@ class ReutersBridge extends BridgeAbstract
{
$img_placeholder = '';
- foreach ($images as $image) { // Add more image to article.
+ foreach ($images as $image) {
+ // Add more image to article.
$image_url = $image['url'];
- $image_caption = $image['caption'];
+ $image_caption = $image['caption'] ?? $image['alt_text'] ?? $image['subtitle'] ?? '';
$image_alt_text = '';
- if (isset($image['alt_text'])) {
- $image_alt_text = $image['alt_text'];
- } else {
- $image_alt_text = $image_caption;
- }
+ $image_alt_text = $image['alt_text'] ?? $image_caption;
$img = "
";
$img_caption = "$image_caption";
$figure = "$img \t $img_caption";
@@ -557,7 +554,11 @@ EOD;
$image_placeholder = $this->handleImage([$story['thumbnail']]);
}
$content = $story['description'] . $image_placeholder;
- $category = [$story['primary_section']['name']];
+ if (isset($story['primary_section']['name'])) {
+ $category = [$story['primary_section']['name']];
+ } else {
+ $category = [];
+ }
} else {
$content_detail = $this->getArticle($article_uri);
$description = $content_detail['content'];