Beispiel #1
0
 public function init()
 {
     $parser = new TubeLink();
     $parser->registerService(new \TubeLink\Service\Youtube());
     $parser->registerService(new \TubeLink\Service\Vimeo());
     $this->_parser = $parser;
 }
 public function testExtract()
 {
     $crawler = new Crawler();
     $str = html_entity_decode(file_get_contents(__DIR__ . '/../../Resources/embedded_videos.html'));
     $crawler->addContent($str);
     $tubelink = TubeLink::create();
     $extractor = new IframeExtractor($tubelink);
     $generated = $extractor->extract($crawler);
     $this->assertCount(3, $generated);
 }
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$url = Vars::get("value");
use TubeLink\TubeLink;
if ($url) {
    $thumbnail = Vars::get("thumbnail");
    $parser = new TubeLink();
    $parser->registerService(new \TubeLink\Service\Youtube());
    $tube = $parser->parse($url);
    if ($thumbnail) {
        echo $tube->thumbnail();
    } else {
        echo $tube->render();
    }
}