mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-05 02:24:35 +02:00
[bridges] Rename bridges that are missing 'Bridges'
The word 'Bridge' is a requirement for the filename and class name. Also documented here (now): https://github.com/rss-bridge/rss-bridge/wiki/how-to-create-a-new-bridge
This commit is contained in:
parent
07f664b2fa
commit
237a26e4ff
4 changed files with 4 additions and 4 deletions
69
bridges/WorldOfTanksBridge.php
Normal file
69
bridges/WorldOfTanksBridge.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
define('WORLD_OF_TANKS', 'http://worldoftanks.eu/');
|
||||
define('NEWS', '/news/');
|
||||
class WorldOfTanksBridge extends HttpCachingBridgeAbstract{
|
||||
|
||||
private $lang = "fr";
|
||||
public $uri = WORLD_OF_TANKS;
|
||||
|
||||
public function loadMetadatas() {
|
||||
|
||||
$this->maintainer = "mitsukarenai";
|
||||
$this->name = "World of Tanks";
|
||||
$this->uri = "http://worldoftanks.eu/";
|
||||
$this->description = "News about the tank slaughter game.";
|
||||
|
||||
$this->parameters[] = array(
|
||||
'category'=>array(
|
||||
'name'=>'ID de la catégorie',
|
||||
'type'=>'number'
|
||||
),
|
||||
'lang'=>array(
|
||||
'name'=>'Langue',
|
||||
'type'=>'list',
|
||||
'values'=>array(
|
||||
'Français'=>'fr',
|
||||
'English'=>'en',
|
||||
'Español'=>'es',
|
||||
'Deutsch'=>'de',
|
||||
'Čeština'=>'cs',
|
||||
'Polski'=>'pl',
|
||||
'Türkçe'=>'tr'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function collectData(array $param){
|
||||
if (!empty($param['lang'])) {
|
||||
$this->lang = $param['lang'];
|
||||
}
|
||||
if(empty($param['category'])) {
|
||||
$this->uri = WORLD_OF_TANKS.$this->lang.NEWS;
|
||||
} else {
|
||||
$this->uri = WORLD_OF_TANKS.$this->lang.NEWS.'pc-browser/'.$param['category']."/";
|
||||
}
|
||||
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request '.$this->getURI());
|
||||
$this->message("loaded HTML from ".$this->getURI());
|
||||
// customize name
|
||||
$this->name = $html->find('title', 0)->innertext;
|
||||
foreach($html->find('.b-imgblock_ico') as $infoLink) {
|
||||
$this->parseLine($infoLink);
|
||||
}
|
||||
}
|
||||
|
||||
private function parseLine($infoLink) {
|
||||
$item = array();
|
||||
$item['uri'] = WORLD_OF_TANKS.$infoLink->href;
|
||||
// now load that uri from cache
|
||||
$this->message("loading page ".$item['uri']);
|
||||
$articlePage = str_get_html($this->get_cached($item['uri']));
|
||||
$content = $articlePage->find('.l-content', 0);
|
||||
HTMLSanitizer::defaultImageSrcTo($content, WORLD_OF_TANKS);
|
||||
$item['title'] = $content->find('h1', 0)->innertext;
|
||||
$item['content'] = $content->find('.b-content', 0)->innertext;
|
||||
$item['timestamp'] = $content->find('.b-statistic_time', 0)->getAttribute("data-timestamp");
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue