mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-10 00:48:48 +00:00
parent
a9fd3b9e61
commit
8f9147458d
@ -20,11 +20,13 @@ class GatesNotesBridge extends BridgeAbstract
|
|||||||
$apiUrl = self::URI . $api_endpoint . http_build_query($params);
|
$apiUrl = self::URI . $api_endpoint . http_build_query($params);
|
||||||
|
|
||||||
$rawContent = getContents($apiUrl);
|
$rawContent = getContents($apiUrl);
|
||||||
$cleanedContent = str_replace('\r\n', '', substr($rawContent, 1, -1));
|
$cleanedContent = str_replace([
|
||||||
$cleanedContent = str_replace('\"', '"', $cleanedContent);
|
'<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">',
|
||||||
|
'</string>',
|
||||||
|
], '', $rawContent);
|
||||||
|
|
||||||
// The content is actually a json between quotes with \r\n inserted
|
// The content is actually a json between quotes with \r\n inserted
|
||||||
$json = json_decode($cleanedContent);
|
$json = Json::decode($cleanedContent, false);
|
||||||
|
|
||||||
foreach ($json as $article) {
|
foreach ($json as $article) {
|
||||||
$item = [];
|
$item = [];
|
||||||
@ -57,8 +59,10 @@ class GatesNotesBridge extends BridgeAbstract
|
|||||||
$article_html = defaultLinkTo($article_html, $this->getURI());
|
$article_html = defaultLinkTo($article_html, $this->getURI());
|
||||||
|
|
||||||
$top_description = '<p>' . $article_html->find('div.article_top_description', 0)->innertext . '</p>';
|
$top_description = '<p>' . $article_html->find('div.article_top_description', 0)->innertext . '</p>';
|
||||||
$hero_image = '<img src=' . $article_html->find('img.article_top_DMT_Image', 0)->getAttribute('data-src') . '>';
|
$heroImage = $article_html->find('img.article_top_DMT_Image', 0);
|
||||||
|
if ($heroImage) {
|
||||||
|
$hero_image = '<img src=' . $heroImage->getAttribute('data-src') . '>';
|
||||||
|
}
|
||||||
$article_body = $article_html->find('div.TGN_Article_ReadTimeSection', 0);
|
$article_body = $article_html->find('div.TGN_Article_ReadTimeSection', 0);
|
||||||
|
|
||||||
// Remove the menu bar on some articles (PDF download etc.)
|
// Remove the menu bar on some articles (PDF download etc.)
|
||||||
|
Loading…
Reference in New Issue
Block a user