From cabf7a748a2837285c2f184406afbe3136ce7fc5 Mon Sep 17 00:00:00 2001
From: csisoap <33269526+csisoap@users.noreply.github.com>
Date: Tue, 20 Jul 2021 14:54:07 +0700
Subject: [PATCH] [ReutersBridge] Change timestamp, add new feed, add alt text
to image (#2150)
---
bridges/ReutersBridge.php | 52 +++++++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/bridges/ReutersBridge.php b/bridges/ReutersBridge.php
index e3e2f103..755eebea 100644
--- a/bridges/ReutersBridge.php
+++ b/bridges/ReutersBridge.php
@@ -38,6 +38,7 @@ class ReutersBridge extends BridgeAbstract
'Energy' => 'energy',
'Entertainment' => 'chan:8ym8q8dl',
'Environment' => 'chan:6u4f0jgs',
+ 'Fact Check' => 'chan:abtpk0vm',
'Health' => 'chan:8hw7807a',
'Lifestyle' => 'life',
'Markets' => 'markets',
@@ -128,12 +129,14 @@ class ReutersBridge extends BridgeAbstract
$authorlist = $first['story']['authors'];
$category = $first['story']['channel']['name'];
$image_list = $first['story']['images'];
+ $published_at = $first['story']['published_at'];
$content_detail = array(
'content' => $this->handleArticleContent($article_content),
'author' => $this->handleAuthorName($authorlist),
'category' => $category,
'images' => $this->handleImage($image_list),
+ 'published_at' => $published_at
);
return $content_detail;
}
@@ -144,7 +147,7 @@ class ReutersBridge extends BridgeAbstract
foreach($images as $image) { // Add more image to article.
$image_url = $image['url'];
$image_caption = $image['caption'];
- $img = "
";
+ $img = "
";
$img_caption = "$image_caption";
$figure = "$img \t $img_caption";
$img_placeholder = $img_placeholder . $figure;
@@ -202,6 +205,51 @@ class ReutersBridge extends BridgeAbstract
case 'p_table':
$description = $description . $content['content'];
break;
+ case 'upstream_embed':
+ $media_type = $content['media_type'];
+ $cid = $content['cid'];
+ $embed = '';
+ switch ($media_type) {
+ case 'tweet':
+ $url = "https://platform.twitter.com/embed/Tweet.html?id=$cid";
+ $embed .= <<
+
+EOD;
+ break;
+ case 'instagram':
+ $url = "https://instagram.com/p/$cid/media/?size=l";
+ $embed .= <<
+EOD;
+ break;
+ case 'youtube':
+ $url = "https://www.youtube.com/embed/$cid";
+ $embed .= <<
+
+EOD;
+ break;
+ }
+ $description .= $embed;
+ break;
}
}
@@ -253,7 +301,7 @@ class ReutersBridge extends BridgeAbstract
}
$item['title'] = $story['story']['hed'];
- $item['timestamp'] = $story['story']['updated_at'];
+ $item['timestamp'] = $content_detail['published_at'];
$item['uri'] = $story['template_action']['url'];
$this->items[] = $item;
}