2017-03-20 21:32:31 +01:00
|
|
|
<?php
|
|
|
|
class RainbowSixSiegeBridge extends BridgeAbstract {
|
|
|
|
|
|
|
|
const MAINTAINER = 'corenting';
|
|
|
|
const NAME = 'Rainbow Six Siege Blog';
|
|
|
|
const URI = 'https://rainbow6.ubisoft.com/siege/en-us/news/';
|
|
|
|
const CACHE_TIMEOUT = 7200; // 2h
|
|
|
|
const DESCRIPTION = 'Latest articles from the Rainbow Six Siege blog';
|
|
|
|
|
2018-10-26 18:07:34 +02:00
|
|
|
public function getIcon() {
|
|
|
|
return 'https://ubistatic19-a.akamaihd.net/resource/en-us/game/rainbow6/siege-v3/r6s-favicon_316592.ico';
|
|
|
|
}
|
|
|
|
|
2017-03-20 21:32:31 +01:00
|
|
|
public function collectData(){
|
2018-06-29 23:55:33 +02:00
|
|
|
$dlUrl = 'https://prod-tridionservice.ubisoft.com/live/v1/News/Latest?templateId=tcm%3A152-7677';
|
2018-11-05 18:20:17 +01:00
|
|
|
$dlUrl .= '8-32&pageIndex=0&pageSize=10&language=en-US&detailPageId=tcm%3A150-194572-64';
|
|
|
|
$dlUrl .= '&keywordList=233416%2C316144%2C233418%2C233417&siteId=undefined&useSeoFriendlyUrl=true';
|
2017-07-14 22:05:51 +02:00
|
|
|
$jsonString = getContents($dlUrl) or returnServerError('Error while downloading the website content');
|
2017-03-20 21:32:31 +01:00
|
|
|
|
2017-07-14 22:05:51 +02:00
|
|
|
$json = json_decode($jsonString, true);
|
|
|
|
$json = $json['items'];
|
2017-03-20 21:32:31 +01:00
|
|
|
|
|
|
|
// Start at index 2 to remove highlighted articles
|
2017-07-29 19:28:00 +02:00
|
|
|
for($i = 0; $i < count($json); $i++) {
|
2017-07-14 22:05:51 +02:00
|
|
|
$jsonItem = $json[$i]['Content'];
|
|
|
|
$article = str_get_html($jsonItem);
|
2017-03-20 21:32:31 +01:00
|
|
|
|
|
|
|
$item = array();
|
|
|
|
|
|
|
|
$uri = $article->find('h3 a', 0)->href;
|
|
|
|
$uri = 'https://rainbow6.ubisoft.com' . $uri;
|
|
|
|
$item['uri'] = $uri;
|
2017-07-14 22:05:51 +02:00
|
|
|
$item['title'] = $article->find('h3', 0)->plaintext;
|
|
|
|
$item['content'] = $article->find('img', 0)->outertext . '<br />' . $article->find('strong', 0)->plaintext;
|
|
|
|
$item['timestamp'] = strtotime($article->find('p.news_date', 0)->plaintext);
|
2017-03-20 21:32:31 +01:00
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|