diff --git a/controllers/Parse.php b/controllers/Parse.php index b2cd612..5b33763 100644 --- a/controllers/Parse.php +++ b/controllers/Parse.php @@ -117,24 +117,6 @@ class Parse { - // Check for known services - $host = parse_url($result['url'], PHP_URL_HOST); - - if(in_array($host, ['www.instagram.com','instagram.com'])) { - list($data, $parsed) = Formats\Instagram::parse($result['body'], $result['url'], $this->http); - if($request->get('include_original')) - $data['original'] = $parsed; - $data['url'] = $result['url']; - $data['code'] = $result['code']; - return $this->respond($response, 200, $data); - } - - if($host == 'xkcd.com' && parse_url($url, PHP_URL_PATH) != '/') { - $data = Formats\XKCD::parse($result['body'], $url); - $data['url'] = $result['url']; - $data['code'] = $result['code']; - return $this->respond($response, 200, $data); - } // attempt to parse the page as HTML $doc = new DOMDocument(); diff --git a/lib/XRay/Parser.php b/lib/XRay/Parser.php index 97fab1f..38efb5a 100644 --- a/lib/XRay/Parser.php +++ b/lib/XRay/Parser.php @@ -26,7 +26,9 @@ class Parser { return Formats\GitHub::parse($body, $url); } - + if(Formats\XKCD::matches($url)) { + return Formats\XKCD::parse($body, $url); + } return [ 'data' => [