|
@ -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
|
|
|
// attempt to parse the page as HTML
|
|
|
$doc = new DOMDocument(); |
|
|
$doc = new DOMDocument(); |
|
|