1
0
Fork 0
forked from blallo/rss-bridge

BooruProject: tighter param control | WorldOfTanks: URL format update

This commit is contained in:
Mitsukarenai 2015-09-12 20:00:26 +02:00
parent f643617cac
commit c030d011d2
2 changed files with 5 additions and 5 deletions

View file

@ -2,24 +2,24 @@
/** /**
* RssBridgeBooruproject * RssBridgeBooruproject
* Returns images from given page * Returns images from given page
* 2014-05-25
* *
* @name Booruproject * @name Booruproject
* @homepage http://booru.org/ * @homepage http://booru.org/
* @description Returns images from given page and booruproject instance (****.booru.org) * @description Returns images from given page and booruproject instance (****.booru.org)
* @maintainer mitsukarenai * @maintainer mitsukarenai
* @update 2015-09-12
* @use1(i="instance (required)", p="page", t="tags") * @use1(i="instance (required)", p="page", t="tags")
*/ */
class BooruprojectBridge extends BridgeAbstract{ class BooruprojectBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
$page = 0; $tags = ''; $page = 0; $tags = '';
if (isset($param['p'])) { if (!empty($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']); $page = (int)preg_replace("/[^0-9]/",'', $param['p']);
$page = $page - 1; $page = $page - 1;
$page = $page * 20; $page = $page * 20;
} }
if (isset($param['t'])) { if (!empty($param['t'])) {
$tags = '&tags='.urlencode($param['t']); $tags = '&tags='.urlencode($param['t']);
} }
if (empty($param['i'])) { if (empty($param['i'])) {

View file

@ -3,7 +3,7 @@
* *
* @name World of Tanks * @name World of Tanks
* @description News about the tank slaughter game. Language can be fr, ? * @description News about the tank slaughter game. Language can be fr, ?
* @update 26/03/2014 * @update 2015-09-12
* @use1(lang="Searched language",category="Category id") * @use1(lang="Searched language",category="Category id")
*/ */
define('WORLD_OF_TANKS', 'http://worldoftanks.eu/'); define('WORLD_OF_TANKS', 'http://worldoftanks.eu/');
@ -20,7 +20,7 @@ class WorldOfTanks extends HttpCachingBridgeAbstract{
if(empty($param['category'])) { if(empty($param['category'])) {
$this->uri = WORLD_OF_TANKS.$this->lang.NEWS; $this->uri = WORLD_OF_TANKS.$this->lang.NEWS;
} else { } else {
$this->uri = WORLD_OF_TANKS.$this->lang.NEWS.$param['category']."/"; $this->uri = WORLD_OF_TANKS.$this->lang.NEWS.'pc-browser/'.$param['category']."/";
} }
$html = file_get_html($this->getURI()) or $this->returnError('Could not request '.$this->getURI(), 404); $html = file_get_html($this->getURI()) or $this->returnError('Could not request '.$this->getURI(), 404);
$this->message("loaded HTML from ".$this->getURI()); $this->message("loaded HTML from ".$this->getURI());