Skip to content

Library for Youtube API V3. User can set search parameters, and get a video title and video ID feed.

License

Notifications You must be signed in to change notification settings

chopin2256/Youtube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Youtube API -v3 ####Notes I've used the Zend library to query Youtube results, but the library is convoluted, difficult to extend, and written for version 2. I created my own library specifically geared towards V3. It's much easier to extend, and ALOT faster and less expensive in retriving Titles and VideoIDS. This is for two reasons. I am using version 3, and I also make use of static variables. Thus, there is no need to continuously call the API on every "get" function until the "clear" function is called.

####References

####How To Use

  • Be sure to require Youtube.php: require_once('Youtube/Youtube.php');
  • Instantiate your object: $yt = new Youtube();
  • Set your Youtube API key: $yt->key('{API_KEY}');
  • Set your Youtube search parameters:
$yt->set()->
        q('Search Query')->
        maxResults(10)->
        order('relevance')->
        safeSearch('none')->
        videoDuration('any')->
        videoEmbeddable('true')->
        regionCode("US");
  • Get the Youtube Title and Youtube Video IDs as arrays:
$id = $yt->get()->id();
$title = $yt->get()->title();

If for example, you set maxResults = 10, you will retrieve an output of 10 ids and 10 titles in a feed. $id and $title are arrays that hold this feed, and they can be iterated through in a for loop.

  • Be sure you call the clear function after you are done retrieving results: $yt->clear();
  • A shell example is provided in index.php

####Real Example Usage

About

Library for Youtube API V3. User can set search parameters, and get a video title and video ID feed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages