2017 © Pedro Peláez
 

library youtube-extract

Library for extracting youtube meta data

image

mi6crazyheart/youtube-extract

Library for extracting youtube meta data

  • Monday, September 12, 2016
  • by mi6crazyheart
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

youtube-extract

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)

Meta info supported

  • video thumbnails
  • video titles
  • video description
  • video statistics

Installation

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';

Getting Started

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)

Example

<?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>'; }

The Versions

12/09 2016

dev-master

9999999-dev

Library for extracting youtube meta data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Suresh Kumar Majhi

youtube