dev-master
9999999-devLibrary for extracting youtube meta data
MIT
The Requires
The Development Requires
by Suresh Kumar Majhi
youtube
Wallogit.com
2017 © Pedro Peláez
Library for extracting youtube meta data
This is a simple wrapper class which will help you to find out youtube video meta info from youtube video URL. Internally it uses youtube's YouTube Data API. It requires Google API key to connect with youtube server & extract data. For more info Ref- https://developers.google.com/youtube/v3/getting-started#before-you-start, (*1)
Through Composer., (*2)
composer require mi6crazyheart/youtube-extract dev-master
After installing, you need to require Composer's autoloader., (*3)
require __DIR__ . '/vendor/autoload.php';
This wrapper has 5 methods. - fetchErrorInfo() : To get all error details. - fetchThumbnails() : Extract all video thumbnails information. - fetchTitle() : Fetch video title. - fetchDescription() : Fetch video description. - fetchStatistics() : Fetch video statistics like- view count, like count, dis like count, favorite count, comment count., (*4)
<?php
require __DIR__ . '/vendor/autoload.php';
$videoUrl = "https://www.youtube.com/watch?v=K5WW7JOBSjg";
$googleApiKey = "USE-YOUR-Google-API-KEY";
$Meta = new Youtube\Extract\Meta($videoUrl, $googleApiKey);
if(count($Meta->fetchErrorInfo())){
echo '
';
print_r($Meta->fetchErrorInfo());
echo '
';
} else {
echo "<br><br>Video thumbnails";
echo '
';
print_r($Meta->fetchThumbnails('default'));
echo '
';
echo "<br><br>Video title : ".$Meta->fetchTitle();
echo "<br><br>Video description : ".$Meta->fetchDescription();
echo "<br><br>Video statistics";
echo '<pre>';
print_r($Meta->fetchStatistics());
echo '</pre>';
}
Library for extracting youtube meta data
MIT
youtube