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:----TO/f5Y9Qz8+M7ipqvHMQY9ZJPwkOTBnFj9s2JYLl80OXKP05qbLNrXoS9xpHCy3GPIJci1ZUGlZYPrlfb1kILto5SCfKizs3sRhMz4skTbfeoISAw+e6gNtUa0aOPqTzqRFmFuumqH1AUjs6r1TpFhcJeJNxjHT0WD2cTNNNGCVvsWwF+wwuDCSpLTv1jj/3H+2aiUpLLvVt0Erq8VhdhNOyu2Db0Tv2p7wixRZ+01zd6uFnUF6Ne2LnuWs2rc7GVvfzphgKuCKtfCOdwW+ItIj8ZnxOuetDU+VJ/LvgcGjCjFjujNuzebkfT7APK8TPuypfUtd9VeTTPiqyQdj+trD5sH4Nm17qnVoHBhAt6QKZK0tYRbj6YvIdeu1aEN2Ot8zIEEiySlZUs3lBYFXiLYGLUYyD/swnZfkByuy605igW+1bJ4YBgYUtlcJosnyeAJg2IzejJAh0TG3IFtcsWlHp2MPgX2WkVvhiVPyf3GT7d5BTn+v3gImFw9TW69uTCpB74YQzfJ1rajNxIQ2KvpzimavdaXpySKEUueCSB1jEKsVr//KQRW3lgd8BkF9MHN/4jUIKmlLaPYUigPFPxShARZjmhuXCq+EQ0p9HQfJ/RPTB8o45jnTPZrEiae+j03BDBPuin5ChRYPXPClT7C2tTnXzirO3Pm2Kvls4GWs=----ATTACHMENT:----MjM1OTYzMjI1ODU1MDIyMyAyMTY3ODc1MDI2Njg3NjAyIDIzMzcwNDI3Njc3NjExNjY=