Embed icon indicating copy to clipboard operation
Embed copied to clipboard

Any clever way to get Playbuzz iframe embed code?

Open onigetoc opened this issue 8 years ago • 4 comments

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

onigetoc avatar Feb 07 '17 02:02 onigetoc

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.

onigetoc avatar Feb 07 '17 02:02 onigetoc

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

oscarotero avatar Feb 07 '17 07:02 oscarotero

How do i get the image url in a adapter? I need this to get the ID

onigetoc avatar Feb 12 '17 00:02 onigetoc

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.

oscarotero avatar Feb 12 '17 11:02 oscarotero