From 0c1f68d97ac6325329ce797ceaee5cbf5b4c603a Mon Sep 17 00:00:00 2001 From: Alexis CHEMEL Date: Mon, 5 Dec 2016 22:16:28 +0100 Subject: [PATCH] MixCloudBridge #436 --- bridges/MixCloudBridge.php | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 bridges/MixCloudBridge.php diff --git a/bridges/MixCloudBridge.php b/bridges/MixCloudBridge.php new file mode 100644 index 00000000..505cac50 --- /dev/null +++ b/bridges/MixCloudBridge.php @@ -0,0 +1,46 @@ + array( + 'name' => 'username', + 'required' => true, + ))); + + public function getName(){ + + return 'MixCloud - '.$this->getInput('u'); + } + + public function collectData() { + + $html = getSimpleHTMLDOM(self::URI.'/'.$this->getInput('u')) + or returnServerError('Could not request MixCloud.'); + + foreach($html->find('div.card-elements-container') as $element) { + + $item = array(); + + $item['uri'] = self::URI.$element->find('h3.card-cloudcast-title a', 0)->getAttribute('href'); + $item['title'] = html_entity_decode($element->find('h3.card-cloudcast-title a span', 0)->getAttribute('title'), ENT_QUOTES); + + $image = $element->find('img.image-for-cloudcast', 0); + + if( $image ) { + + $item['content'] = ''; + } + + $item['author'] = trim($element->find('h4.card-cloudcast-user a', 0)->innertext); + + $this->items[] = $item; + } + } +}