[WhydBridge] remove useless code

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-27 18:25:24 +02:00
parent 341ce2bf3e
commit 0de4fce41d

View file

@ -1,9 +1,6 @@
<?php <?php
class WhydBridge extends BridgeAbstract{ class WhydBridge extends BridgeAbstract{
private $request;
public $name;
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "kranack"; $this->maintainer = "kranack";
@ -23,26 +20,26 @@ class WhydBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$param=$this->parameters[$this->queriedContext]; $param=$this->parameters[$this->queriedContext];
$html = ''; $html = '';
if (isset($param['u']['value'])) if (strlen(preg_replace("/[^0-9a-f]/",'', $param['u']['value'])) == 24){
{ // is input the userid ?
$this->request = $param['u']['value']; $html = $this->getSimpleHTMLDOM(
if (strlen(preg_replace("/[^0-9a-f]/",'', $this->request)) == 24) { // is input the userid ? $this->uri.'u/'.preg_replace("/[^0-9a-f]/",'', $param['u']['value'])
$html = $this->getSimpleHTMLDOM('http://www.whyd.com/u/'.preg_replace("/[^0-9a-f]/",'', $this->request)) or $this->returnServerError('No results for this query.'); ) or $this->returnServerError('No results for this query.');
} else { // input may be the username } else { // input may be the username
$html = $this->getSimpleHTMLDOM('http://www.whyd.com/search?q='.urlencode($this->request)) or $this->returnServerError('No results for this query.'); $html = $this->getSimpleHTMLDOM(
for ($j = 0; $j < 5; $j++) { $this->uri.'search?q='.urlencode($param['u']['value'])
if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($this->request)) { ) or $this->returnServerError('No results for this query.');
$html = $this->getSimpleHTMLDOM('http://www.whyd.com' . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')) or $this->returnServerError('No results for this query');
break; for ($j = 0; $j < 5; $j++) {
} if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($param['u']['value'])) {
} $html = $this->getSimpleHTMLDOM(
} $this->uri . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')
$this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext; ) or $this->returnServerError('No results for this query');
} break;
else }
{ }
$this->returnClientError('You must specify username'); }
} $this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
for($i = 0; $i < 10; $i++) { for($i = 0; $i < 10; $i++) {
$track = $html->find('div.post', $i); $track = $html->find('div.post', $i);