kphoen / vex
该软件包已被 废弃 且不再维护。没有建议的替代软件包。
从任何URL提取视频
1.1.5
2014-11-07 12:49 UTC
Requires (Dev)
Suggests
- ext-curl: Enabling the curl extension allows you to use CurlHttpAdapter.
- guzzle/guzzle: Enabling Guzzle allows you to use the GuzzleHttpAdapter.
- kriswallsmith/buzz: Enabling Buzz allows you to use the BuzzHttpAdapter, it's the recommended HTTP layer.
- zendframework/zend-http: Enabling Zend_Http allows you to use the ZendHttpAdapter
README
Vex 是一个PHP库,可以从任何URL提取视频。
支持的服务
对于以下列表中的每个视频分享网站,一个 平台 类可以识别支持的URL并提取视频数据。
状态
该项目已被 弃用,不应使用。
如果有人神奇地出现并想要维护该项目,我将乐意提供对此存储库的访问权限。
安装
安装Vex的推荐方式是通过composer。
{ "require": { "kphoen/vex": "1.1.*" } }
如果您在应用程序中既不使用 Composer 也不使用 ClassLoader,只需要求提供的自动加载器
require_once 'src/autoload.php';
您已经完成了。
使用方法
use Vex\Vex; $adapter = new \Vex\HttpAdapter\BuzzHttpAdapter(); $platform = \Vex\Platform\RutubePlatform($adapter); $vex = new Vex($platform); $video = $vex->extract('https://rutube.ru/video/b5a392c180ddfe3e1ebded38f9f9dc52/'); // Show the video title echo $video->getTitle(); // Shows the embedded video HTML echo $video->getCode(); // Show the video link echo $video->getLink(); // Show the video duration echo $video->getDuration(); // Show the video thumbnail echo $video->getThumb(); $url = $vex->reverse('<iframe width="640" height="360" src="http://rutube.ru/video/embed/6236741" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen scrolling="no"></iframe>'); // shows http://rutube.ru/video/9f4dc6bc2db6b6051ea07fb20234c6cc/ echo $url
测试
要运行单元测试,您需要cURL和一套您可以使用Composer安装的依赖项
php composer.phar install --dev
安装完成后,只需运行以下命令
phpunit
致谢
- Kévin Gomez
- William Durand - 对于
HttpAdapter
部分,它从 Geocoder 中借用 - Jérôme Tamarelle - 从他那里借用了这个README
许可证
Vex 在MIT许可证下发布。有关详细信息,请参阅捆绑的LICENSE文件。