定制 mascame/video-checker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mascame/video-checker

最新稳定版本:2.3

Composer 安装命令:

composer require mascame/video-checker

包简介

Check if a video is available online.

README 文档

README

Latest Stable Version License

Check if a video is available online.

Installation

Require this package in your composer.json and run composer update:

"mascame/video-checker": "2.*"

Usage

Just use $provider->check(videoId) with the provider you want

$youtubeProvider = new Mascame\VideoChecker\YoutubeProvider();

var_dump($youtubeProvider->check('C7OfO6r_5m0')); // true
var_dump($youtubeProvider->check('CWO3Tuo35-o')); // false

// Check if a video is disponible with API
$youtubeProviderWithAPI = new Mascame\VideoChecker\YoutubeProvider('MY_API_KEY');

var_dump($youtubeProviderWithAPI->check('GOHXRe9o_Ls')); //false

// Check if a video is disponible on a certain country
var_dump($youtubeProviderWithAPI->check('GOHXRe9o_Ls', 'ES')); // false
var_dump($youtubeProviderWithAPI->check('CWO3Tuo35-o', 'IT')); // true

// As array (youtube has an API limit of 50 ids per call)
var_dump($youtubeProviderWithAPI->check(['CWO3Tuo35-o', 'GOHXRe9o_Ls'], 'ES')); // ['CWO3Tuo35-o' => true, 'GOHXRe9o_Ls' => false]

$vimeoProvider = new Mascame\VideoChecker\VimeoProvider();

var_dump($vimeoProvider->check('31161781')); // true
var_dump($vimeoProvider->check('34134308a')); // false

$dailymotionProvider = new Mascame\VideoChecker\DailymotionProvider();

var_dump($dailymotionProvider->check('x38rpxc')); // true
var_dump($dailymotionProvider->check('x38rpxc3232')); // false

// As array
var_dump($dailymotionProvider->check(['x38rpxc', 'x38rpxc3232'])); // ['x38rpxc' => true, 'x38rpxc3232' => false]

Running tests

Install composer dependencies in development mode

composer update --dev

vendor/bin/phpunit tests/TestVideoChecker.php

Changelog

2.3

  • Youtube Provider: Throw exception if API call fails or has errors (to avoid false negatives)

2.2

  • Fixes stored Ids when was not in API response items
  • Youtube Provider: get total API calls

2.1

  • Allows array as parameter in 'check' method (output will be an array ['video-id' => bool, 'video-id2' => bool])
  • Youtube Provider: Using ids parameter as array will avoid unneeded API calls (and dont waste quota)

2.0

  • Allow Youtube API check without country specified
  • Simplified API
  • Updated tests

1.2

  • Added API key injection via constructor for YoutubeProvider

1.1

  • Added checkByCountry for YoutubeProvider

1.0

  • Added Youtube, Vimeo & Dailymotion providers

Support

If you want to give your opinion, you can send me an email, comment the project directly (if you want to contribute with information or resources) or fork the project and make a pull request.

Also I will be grateful if you want to make a donation, this project hasn't got a death date and it wants to be improved constantly:

Website Button

License

MIT

统计信息

  • 总下载量: 4.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-08