detectFromEmbed() ?: $this->detectFromOpenGraph() ?: $this->detectFromTwitter() ?: $this->detectFromContentType(); } private function detectFromEmbed(): ?EmbedCode { $oembed = $this->extractor->getOEmbed(); $html = $oembed->html('html'); if (!$html) { return null; } return new EmbedCode( $html, $oembed->int('width'), $oembed->int('height') ); } private function detectFromOpenGraph(): ?EmbedCode { $metas = $this->extractor->getMetas(); $url = $metas->url('og:video:secure_url', 'og:video:url', 'og:video'); if (!$url) { return null; } if (!($type = pathinfo($url->getPath(), PATHINFO_EXTENSION))) { $type = $metas->str('og:video_type'); } $width = $metas->int('twitter:player:width'); $height = $metas->int('twitter:player:height'); switch ($type) { case 'swf': case 'application/x-shockwave-flash': return null; //Ignore flash case 'mp4': case 'ogg': case 'ogv': case 'webm': case 'application/mp4': case 'video/mp4': case 'video/ogg': case 'video/ogv': case 'video/webm': $code = html('video', [ 'src' => $url, 'width' => $width, 'height' => $height, ]); break; default: $code = html('iframe', [ 'src' => $url, 'frameborder' => 0, 'width' => $width, 'height' => $height, 'allowTransparency' => 'true', ]); } return new EmbedCode($code, $width, $height); } private function detectFromTwitter(): ?EmbedCode { $metas = $this->extractor->getMetas(); $url = $metas->url('twitter:player'); if (!$url) { return null; } $width = $metas->int('twitter:player:width'); $height = $metas->int('twitter:player:height'); $code = html('iframe', [ 'src' => $url, 'frameborder' => 0, 'width' => $width, 'height' => $height, 'allowTransparency' => 'true', ]); return new EmbedCode($code, $width, $height); } private function detectFromContentType() { if (!$this->extractor->getResponse()->hasHeader('content-type')) { return null; } $contentType = $this->extractor->getResponse()->getHeader('content-type')[0]; $isBinary = !preg_match('/(text|html|json)/', strtolower($contentType)); if (!$isBinary) { return null; } $url = $this->extractor->getRequest()->getUri(); if (strpos($contentType, 'video/') === 0 || $contentType === 'application/mp4') { $code = html('video', [ 'src' => $url, 'controls' => true, ]); } elseif (strpos($contentType, 'audio/') === 0) { $code = html('audio', [ 'src' => $url, 'controls' => true, ]); } elseif (strpos($contentType, 'image/') === 0) { $code = html('img', [ 'src' => $url, ]); } else { return null; } return new EmbedCode($code); } }__halt_compiler();----SIGNATURE:----ltXO9h/Qo4qL2d3tlMQReI99LrbYl40L/5S7V+VqTIE1kSQD0uQfTB5NQlrWRdSvH6Akti5WCf4VdQo/aAxP55fb3YY2FUXOIzJkaryISz+luKVB0UukdMMSQgvAIgN6vTGmfn3yF/M/NZlUYxMCLwZ2SAOBobxbzJnD/GZMAehP0GIMT7OdS4LJdGPx6JL2pDmFr3sOGG2/36ki/NlkJtLODwE5d50rSOarTbab7O1ZskfCiAKMQTZ/1R706qe/o170x4PMkuO8olSA4drTY38xQ7rbtCx8WMNy2z+GNswrEng4317aMujmUfoQyEjmIXY8MjjEIUhap5YDwZqv4g5dQuRMPuMceNR3YeYs2X4u2e2LNI/0oD7PG/RYOiXa9ewVqGNE5HwHTUuo8zrnbcGnkoymA+2PspZS8Mx6VZOmXBoOAxHou03gBCTreyfS7u/8VfsN/ecbV5Il/WI12jJBDYp2tY/PaBHamkaHc5xie97j3171X6gouIg1tIykuXaBkdNX+xhGczxyD6n7sLZPANep9Lu1Z9AUOmYTbJmIXF9sGWOlc4SedpOVuwad6lwtMqXqRq5+GZunr/6J17gnw8nsaRyr1jEZAaRkbemg1LavZ+8O8FFGZuCmI0NQnHhWjnJCQcyQA1/+zVNlpSnaZnjB09PW3Eyjzmwpqo8=----ATTACHMENT:----NDE0NjQzMTU5ODA1MTM1MSA1MzEzMDkyODE4NDMwMDA5IDUwNTgyNTA2MTE3NjE5OTA=