PHP Classes

PHP Media Search Engine: Search multiple video sites for given keywords

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 62%Total: 344 All time: 7,052 This week: 56Up
Version License PHP version Categories
awesomemedia 1.0.0The PHP License5.3PHP 5, Searching, Web services, Audio, V...
Description 

Author

This package can search multiple video, audio and picture sites for given keywords.

It can send HTTP requests to the API Web servers of several sites to search for given keywords.

The package provides different classes for each site but the results are returned in arrays with the same format.

Currently it supports DailyMotion, YouTube, Vimeo, SoundCloud and Flickr.

Innovation Award
PHP Programming Innovation award nominee
May 2015
Number 5


Prize: SourceGuarding PHP encoder tool
Sometimes you need to search for videos that can be in multiple sites. Most popular video sites provide an API for searching for videos. However, each one returns results in a different format.

This package that can search multiple video and audio sites at the same time returning results in the same format for all sites.

Manuel Lemos
Picture of Ghali Ahmed
  Performance   Level  
Innovation award
Innovation award
Nominee: 3x

 

Example

<?php
$loader
= require '../vendor/autoload.php';
require
'config_dev.php';

use
MediaGateway\Provider\ProviderChain;
use
MediaGateway\ProviderClientFactory;
use
MediaGateway\Provider\YoutubeProvider;
use
MediaGateway\Provider\VimeoProvider;
use
MediaGateway\Provider\DailymotionProvider;
use
MediaGateway\Provider\SoundcloudProvider;
use
MediaGateway\Provider\FlickrProvider;

$providerChain = new ProviderChain();

$providerChain->addProviders([
    new
YoutubeProvider(new MediaGateway\Client\YoutubeClient($youtubeConfig)),
    new
VimeoProvider(new MediaGateway\Client\VimeoClient($vimeoConfig)),
    new
DailymotionProvider(new MediaGateway\Client\DailymotionClient($dailymotionConfig)),
    new
SoundcloudProvider(new MediaGateway\Client\SoundcloudClient($soundcloudConfig)),
    new
FlickrProvider(new MediaGateway\Client\FlickrClient($flickerConfig))
]);

$query = new \MediaGateway\Query();
$query->setTerm('kittens')->setLimit(10);

$result = $providerChain->search($query);

print
'<pre>';
print_r($result);


Details

AwesomeMedia

Extensible MediaProvider management script that can query several provider such as Youtube/dailymotion/vimeo and return a list of normalized results.

Installation

Composer

Add the AwesomeMedia library to your composer.json file's require field

{
    "require" : {
        "ghaliano/AwesomeMedia" : "dev-master"
    }
}

How to use?

Client configuration

This is a typical configuration used on the demo https://github.com/ghaliano/awesome-media/blob/master/Demo/config.php

<?php
$youtubeConfig = [
    'developer_key' => null
];    
    
$dailymotionConfig = [
    'api_key' => null, 
    'secret_key'=> null
];

$vimeoConfig = [
    'api_key' => null, 
    'secret_key'=> null, 
    'access_token' => null
];

$soundcloudConfig = [
    'api_key' => '',
    'secret_key' => '',
    'login' => '',
    'password' => ''
];

Single provider

<?php
$loader = require '../vendor/autoload.php';
require 'config_dev.php';
use MediaGateway\ProviderClientFactory;
use MediaGateway\Provider\YoutubeProvider;
$youtubeProvider = new YoutubeProvider(
    ProviderClientFactory::create('youtube', $youtubeConfig)
);
$query = new \MediaGateway\Query();
$query->setTerm('kittens')->setLimit(10);
 
$result = $youtubeProvider->search($query);
print '<pre>';
print_r($result);

Multiple provider

The component use a Chain class to manipulate mutiple providers like one

<?php
$loader = require '../vendor/autoload.php';
require 'config_dev.php';
use MediaGateway\Provider\ProviderChain;
use MediaGateway\ProviderClientFactory;
use MediaGateway\Provider\YoutubeProvider;
use MediaGateway\Provider\VimeoProvider;
use MediaGateway\Provider\DailymotionProvider;
use MediaGateway\Provider\SoundcloudProvider;
use MediaGateway\Provider\FlickrProvider;
$providerChain = new ProviderChain();

$providerChain->addProviders([
    new YoutubeProvider(new MediaGateway\Client\YoutubeClient($youtubeConfig)),
    new VimeoProvider(new MediaGateway\Client\VimeoClient($vimeoConfig)),
    new DailymotionProvider(new MediaGateway\Client\DailymotionClient($dailymotionConfig)),
    new SoundcloudProvider(new MediaGateway\Client\SoundcloudClient($soundcloudConfig)),
    new FlickrProvider(new MediaGateway\Client\FlickrClient($flickerConfig))
]);

$query = new \MediaGateway\Query();
$query->setTerm('kittens')->setLimit(10);
$result = $providerChain->search($query);
print '<pre>';
print_r($result);

Demo

https://github.com/ghaliano/awesome-media/blob/master/Demo/demo.php

TODO

  • Only Search Future is now available: Adding more future (Upload/remove/update MEdia)
  • DATA formating can be in a separate class for each provider
  • Adding other Media type (only video provider are now implemented)
  • Adding test !!!

  Files folder image Files (36)  
File Role Description
Files folder imageDemo (3 files)
Files folder imageMediaGateway (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:344
This week:0
All time:7,052
This week:56Up
 User Ratings  
 
 All time
Utility:80%StarStarStarStarStar
Consistency:75%StarStarStarStar
Documentation:80%StarStarStarStarStar
Examples:70%StarStarStarStar
Tests:-
Videos:-
Overall:62%StarStarStarStar
Rank:908