Skip to content

Commit

Permalink
[WorldOfTanksBridge] Fix bridge (#1197)
Browse files Browse the repository at this point in the history
* Fix #1196 by better protecting page
  • Loading branch information
Riduidel authored and logmanoriginal committed Jun 28, 2019
1 parent 09113c2 commit 1add201
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions bridges/WorldOfTanksBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class WorldOfTanksBridge extends FeedExpander {

const MAINTAINER = 'Riduidel';
const NAME = 'World of Tanks';
const URI = 'http://worldoftanks.eu/';
const URI = 'https://worldoftanks.eu/';
const DESCRIPTION = 'News about the tank slaughter game.';

const PARAMETERS = array( array(
Expand All @@ -22,6 +22,8 @@ class WorldOfTanksBridge extends FeedExpander {
)
));

const POSSIBLE_ARTICLES = array('article', 'rich-article');

public function collectData() {
$this->collectExpandableDatas(sprintf('https://worldoftanks.eu/%s/rss/news/', $this->getInput('lang')));
}
Expand All @@ -40,13 +42,17 @@ protected function parseItem($newsItem){
private function loadFullArticle($uri){
$html = getSimpleHTMLDOMCached($uri);

$content = $html->find('article', 0);
foreach(self::POSSIBLE_ARTICLES as $article_class) {
$content = $html->find('article', 0);

// Remove the scripts, please
foreach($content->find('script') as $script) {
$script->outertext = '';
if($content !== null) {
// Remove the scripts, please
foreach($content->find('script') as $script) {
$script->outertext = '';
}
return $content->innertext;
}
}

return $content->innertext;
return null;
}
}

0 comments on commit 1add201

Please sign in to comment.