Skip to content

Commit

Permalink
fix(NationalGeographicBridge)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvikan committed Mar 31, 2024
1 parent d23fd25 commit e7d0b12
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bridges/NationalGeographicBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private function addStory($story)
}

$image = $story['img'];
$item['enclosures'][] = $image['src'];
$item['enclosures'][] = str_replace(' ', '%20', $image['src']);

foreach ($story['tags'] as $tag) {
$item['categories'][] = $tag['name'] ?? $tag;
Expand Down Expand Up @@ -218,7 +218,10 @@ private function handleImages($image_module, $image_type)
switch ($image_type) {
case 'image':
case 'imagegroup':
$image = $image_module['image'];
$image = $image_module['image'] ?? null;
if (!$image) {
return '';
}
$image_src = $image['src'];
if (isset($image_module['alt'])) {
$image_alt = $image_module['alt'];
Expand Down Expand Up @@ -266,7 +269,11 @@ private function getFullArticle($uri)

$json = json_decode($matches[1][0], true);

$unfiltered_data = $json['page']['content']['article']['frms'];
if (isset($json['page']['content']['article']['frms'])) {
$unfiltered_data = $json['page']['content']['article']['frms'];
} else {
$unfiltered_data = $json['page']['content']['prismarticle']['frms'];
}
$filtered_data = $this->filterArticleData($unfiltered_data);

$article = $filtered_data['edgs'][0];
Expand All @@ -288,7 +295,7 @@ private function getFullArticle($uri)
}
}

$published_date = $article['pbDt'];
$published_date = $article['pbDt'] ?? $article['dt'];
$article_body = $article['bdy'];
$content = '';

Expand Down

0 comments on commit e7d0b12

Please sign in to comment.