public function search($url)
 {
     $requestUrl = self::$api_base . self::$api_path . "?url={$url}&client_id=" . $this->key;
     $jsonData = Injector::inst()->get('Fetcher')->fetch($requestUrl);
     $data = json_decode($jsonData, true);
     if ($data['kind'] == 'track') {
         $result = ['Type' => 'soundcloud', 'Video' => $data['id'], 'Image' => $data['artwork_url'], 'Title' => $data['title'], 'Description' => $data['description']];
         return ParseResult::create($result);
     }
     return ParseResult::create(['Error' => "'{$requestUrl}' can't be found on soundclound.com"]);
 }
 public function search($url)
 {
     $host = parse_url($url, PHP_URL_HOST);
     $infoUrl = Controller::join_links(self::$api_base, $host, self::$api_blog_info . $this->key);
     $avatarUrl = Controller::join_links(self::$api_base, $host, self::$api_blog_avatar);
     $jsonData = Injector::inst()->get('Fetcher')->fetch($infoUrl);
     $infoData = json_decode($jsonData, true);
     if ($infoData['meta']['status'] == 200) {
         $result = ['Type' => 'tumblr', 'Image' => $avatarUrl, 'Title' => $infoData['response']['blog']['title'], 'Description' => $infoData['response']['blog']['description']];
         return ParseResult::create($result);
     }
     return ParseResult::create(['Error' => "'{$infoUrl}' can't be found on tumblr.com"]);
 }
 /**
  * @param string $url the url to parse
  * @return ParseResult the website in a result object
  */
 public static function parse($url)
 {
     // check if we have a provider
     $providers = self::get_api_providers();
     foreach ($providers as $provider) {
         /** @var IApiProvider $provider */
         if ($provider->isProvided($url)) {
             return $provider->search($url);
         }
     }
     // otherwise fetch data
     try {
         $html = Injector::inst()->get('Fetcher')->fetch($url);
         // load xpath
         $xpathObj = self::load_xpath($html);
     } catch (Exception $ex) {
         return ParseResult::create(['Error' => $ex->getMessage()]);
     }
     // find open graph and meta data
     $ogData = self::get_open_graph_data($xpathObj);
     $metaData = self::get_meta_data($xpathObj);
     // merge data
     $data = array_merge($metaData, $ogData);
     // if no image provided - find image
     if (!array_key_exists('Image', $data)) {
         $data['Image'] = self::find_content_image($xpathObj, $url);
     }
     // create and return result
     return ParseResult::create($data);
 }