pokap / media
该包已被 废弃 且不再维护。未建议替代包。
该包的最新版本(v1.0.1)没有可用的许可证信息。
简单地通过链接加载媒体元数据。
v1.0.1
2012-05-10 12:06 UTC
Requires
- php: >=5.3.3
- scottmac/opengraph: *
- zendframework/zendframework: *
This package is not auto-updated.
Last update: 2022-02-01 12:20:31 UTC
README
获取媒体链接元数据的一种简单方法。
需要 至少 PHP 5.3.3,因为使用了 Zend 库。也兼容 PHP 5.4。
该包使用 Zend 框架 (https://github.com/zendframework/zf2) 和 OpenGraph (https://github.com/scottmac/opengraph) 来通过开放图协议 (http://ogp.me/) 获取元数据。
用法
<?php $media = new \Pok\Media\Media(); // one service equal to one class // several filters to find the service in relation to the links, be careful not to forget the scheme $media->getServiceManager()->setService( 'youtube', 'Pok\\Media\\Service\\Youtube', array('http:\/\/(www\.)?youtube\.com') ); $uri = new \Zend\Uri\Uri('http://www.youtube.com/watch?v=uh9oUHO2dxE&useless_data'); // get instance of \Pok\Media\Service\Youtube with id (uh9oUHO2dxE), title, description of video, etc. // false if error. $service = $media->analyse($uri); echo $uri->toString(); // http://www.youtube.com/watch?v=uh9oUHO2dxE ?>