1
0
Fork 0
forked from blallo/rss-bridge

[AskfmBridge] remove useless code and fix getName() and getURI()

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-28 01:48:57 +02:00
parent 16dc7fcb6f
commit e9ff7b32f1

View file

@ -16,13 +16,8 @@ class AskfmBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
if (isset($this->getInput('u'))) { $html = $this->getSimpleHTMLDOM($this->getURI())
$this->request = $this->getInput('u'); or $this->returnServerError('Requested username can\'t be found.');
$html = $this->getSimpleHTMLDOM('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnServerError('Requested username can\'t be found.');
}
else {
$this->returnClientError('You must specify a username (?u=...).');
}
foreach($html->find('div.streamItem-answer') as $element) { foreach($html->find('div.streamItem-answer') as $element) {
$item = array(); $item = array();
@ -48,11 +43,11 @@ class AskfmBridge extends BridgeAbstract{
} }
public function getName(){ public function getName(){
return empty($this->request) ? $this->name : $this->request; return $this->name.' : '.$this->getInput('u');
} }
public function getURI(){ public function getURI(){
return empty($this->request) ? $this->uri : 'http://ask.fm/'.urlencode($this->request); return $this->uri.urlencode($this->getInput('u')).'/answers/more?page=0';
} }
public function getCacheDuration(){ public function getCacheDuration(){