[WorldOfTanksBridge] Fix bridge (#1197)
* Fix #1196 by better protecting page
This commit is contained in:
parent
09113c2594
commit
1add201d3b
1 changed files with 13 additions and 7 deletions
|
@ -3,7 +3,7 @@ class WorldOfTanksBridge extends FeedExpander {
|
||||||
|
|
||||||
const MAINTAINER = 'Riduidel';
|
const MAINTAINER = 'Riduidel';
|
||||||
const NAME = 'World of Tanks';
|
const NAME = 'World of Tanks';
|
||||||
const URI = 'http://worldoftanks.eu/';
|
const URI = 'https://worldoftanks.eu/';
|
||||||
const DESCRIPTION = 'News about the tank slaughter game.';
|
const DESCRIPTION = 'News about the tank slaughter game.';
|
||||||
|
|
||||||
const PARAMETERS = array( array(
|
const PARAMETERS = array( array(
|
||||||
|
@ -22,6 +22,8 @@ class WorldOfTanksBridge extends FeedExpander {
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
const POSSIBLE_ARTICLES = array('article', 'rich-article');
|
||||||
|
|
||||||
public function collectData() {
|
public function collectData() {
|
||||||
$this->collectExpandableDatas(sprintf('https://worldoftanks.eu/%s/rss/news/', $this->getInput('lang')));
|
$this->collectExpandableDatas(sprintf('https://worldoftanks.eu/%s/rss/news/', $this->getInput('lang')));
|
||||||
}
|
}
|
||||||
|
@ -40,13 +42,17 @@ class WorldOfTanksBridge extends FeedExpander {
|
||||||
private function loadFullArticle($uri){
|
private function loadFullArticle($uri){
|
||||||
$html = getSimpleHTMLDOMCached($uri);
|
$html = getSimpleHTMLDOMCached($uri);
|
||||||
|
|
||||||
|
foreach(self::POSSIBLE_ARTICLES as $article_class) {
|
||||||
$content = $html->find('article', 0);
|
$content = $html->find('article', 0);
|
||||||
|
|
||||||
|
if($content !== null) {
|
||||||
// Remove the scripts, please
|
// Remove the scripts, please
|
||||||
foreach($content->find('script') as $script) {
|
foreach($content->find('script') as $script) {
|
||||||
$script->outertext = '';
|
$script->outertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content->innertext;
|
return $content->innertext;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue