Embed
Embed copied to clipboard
Any clever way to get Playbuzz iframe embed code?
I did find that the image got the Playbuzz ID, then in the indexphp i did.
if (strpos($url, "playbuzz.com") !== false){
$string= trim($url, "/");
$parts = explode("/", trim($image, "/"));
$playbuzzID = $parts[4];
/*OR*/
// $array = explode('/',$image);
// $rev = array_reverse($array);
// $last = $rev[0];
// $playbuzzID = $rev[1];
$code = '<script type="text/javascript" src="//cdn.playbuzz.com/widget/feed.js"></script><div class="pb_feed" data-embed-by="" data-item="'.$playbuzzID.'" ></div>';
}
The ID is in the og: image. Playbuzz page: http://www.playbuzz.com/richardmahoney10/donald-trump-says-nothing-is-off-the-table-when-it-comes-to-military-action-against-iran-is-this-the
It would be interesting to have a king of extension if matching a url we put our own embed code. For example, New York time video embed ect with the right TYPE and CODE.
You can create an adapter for this. There's some examples in the Adapters directory, for example: https://github.com/oscarotero/Embed/blob/master/src/Adapters/Line.php
How do i get the image url in a adapter? I need this to get the ID
Just $this->image. Note that the adapter is the same object that you get on run Embed::create($url). It uses a magic method to execute the method to calculate the properties.