forked from blallo/rss-bridge
[WhydBridge] remove useless code
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
341ce2bf3e
commit
0de4fce41d
1 changed files with 20 additions and 23 deletions
|
@ -1,9 +1,6 @@
|
|||
<?php
|
||||
class WhydBridge extends BridgeAbstract{
|
||||
|
||||
private $request;
|
||||
public $name;
|
||||
|
||||
public function loadMetadatas() {
|
||||
|
||||
$this->maintainer = "kranack";
|
||||
|
@ -23,26 +20,26 @@ class WhydBridge extends BridgeAbstract{
|
|||
public function collectData(){
|
||||
$param=$this->parameters[$this->queriedContext];
|
||||
$html = '';
|
||||
if (isset($param['u']['value']))
|
||||
{
|
||||
$this->request = $param['u']['value'];
|
||||
if (strlen(preg_replace("/[^0-9a-f]/",'', $this->request)) == 24) { // is input the userid ?
|
||||
$html = $this->getSimpleHTMLDOM('http://www.whyd.com/u/'.preg_replace("/[^0-9a-f]/",'', $this->request)) or $this->returnServerError('No results for this query.');
|
||||
} 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.');
|
||||
for ($j = 0; $j < 5; $j++) {
|
||||
if (strtolower($html->find('div.user', $j)->find('a',0)->plaintext) == strtolower($this->request)) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnClientError('You must specify username');
|
||||
}
|
||||
if (strlen(preg_replace("/[^0-9a-f]/",'', $param['u']['value'])) == 24){
|
||||
// is input the userid ?
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
$this->uri.'u/'.preg_replace("/[^0-9a-f]/",'', $param['u']['value'])
|
||||
) or $this->returnServerError('No results for this query.');
|
||||
} else { // input may be the username
|
||||
$html = $this->getSimpleHTMLDOM(
|
||||
$this->uri.'search?q='.urlencode($param['u']['value'])
|
||||
) or $this->returnServerError('No results for this query.');
|
||||
|
||||
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')
|
||||
) or $this->returnServerError('No results for this query');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
|
||||
|
||||
for($i = 0; $i < 10; $i++) {
|
||||
$track = $html->find('div.post', $i);
|
||||
|
|
Loading…
Reference in a new issue