PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Gianluca Zanferrari   Zanfi PHP YouTube Downloader   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Zanfi PHP YouTube Downloader
Get information and download a video from YouTube
Author: By
Last change:
Date: 1 year ago
Size: 1,560 bytes


Class file image Download

// initialize the class with a yotube video ID or a youtube video url
// $ZanfiYouTube = new ZanfiYouTube('WaEKXGlfYj8');
$ZanfiYouTube = new ZanfiYouTube('');

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~ Data section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// leave parameter emtpy to print all data
// or give a path like: playbackTracking.videostatsWatchtimeUrl
// $ZanfiYouTube->printVideoInfo('streamingData.adaptiveFormats');

// print array with vieo thumbnails
// $ZanfiYouTube->printFormatted($ZanfiYouTube->arr_Video_thumbnails);

// print the array with video adaptive formats

// print the array with the best video+audio data
// $ZanfiYouTube->printFormatted($ZanfiYouTube->get_best_both());

// print the array with the best audio data

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~ Download section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// uncomment where needed

// Starts download of video+audio
// $ZanfiYouTube->download_best_both();

// Starts download of audio
// $ZanfiYouTube->download_best_audio();
// shows the elapsed time for download (use it only after a download...)
// echo('Downloaded ' . $ZanfiYouTube->downloaded_bytes . ' bytes in ' . $ZanfiYouTube->elapsed_time . ' seconds');