diff --git a/bridges/WhydBridge.php b/bridges/WhydBridge.php new file mode 100644 index 0000000..1e6bcd6 --- /dev/null +++ b/bridges/WhydBridge.php @@ -0,0 +1,54 @@ +request = $param['u']; + $html = file_get_html('http://www.whyd.com/u/'.urlencode($this->request)) or $this->returnError('No results for this query.', 404); + $this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext; + } + else + { + $this->returnError('You must specify username', 400); + } + + for($i = 0; $i < 10; $i++) { + $track = $html->find('div.post', $i); + $item = new \Item(); + $item->name = $track->find('h2', 0)->plaintext; + $item->title = $track->find('h2', 0)->plaintext; + $item->content = $track->find('a.thumb',0) . '
' . $track->find('h2', 0)->plaintext; + $item->id = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href'); + $item->uri = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href'); + $this->items[] = $item; + } + } + public function getName(){ + return (!empty($this->name) ? $this->name .' - ' : '') .'Soundcloud Bridge'; + } + + public function getURI(){ + return 'https://www.soundcloud.com/'; + } + + public function getCacheDuration(){ + return 1; // 10 minutes + } +}