Skip to content

📺 PHP based program to download/stream videos from YouTube.

License

Notifications You must be signed in to change notification settings

onlyfrofun/youtube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Youtube PHP Library

📺 PHP based program to download/stream videos from YouTube. Active and frequently updated! ⭐

⚠️ Legal Disclaimer

This program is for personal use only. Downloading copyrighted material without permission is against YouTube's terms of services. By using this program, you are solely responsible for any copyright violations. We are not responsible for people who attempt to use this program in any way that breaks YouTube's terms of services.

Author

Installation

include 'src/YouTube.php';
$youtube = new YouTube();

Usage

Set User Agent

$youtube->setUserAgent('com.google.android.apps.youtube.vr.oculus/1.60.19 (Linux; U; Android 12L; eureka-user Build/SQ3A.220605.009.A1) gzip');

Default: Server User-Agent

Set Buffer Size

$youtube->setBufferSize(1024*512);

Default: 1024*256 (256KB)

Extract Video ID

$id = $youtube->extractVideoId('https://youtube.com/watch?v=XzaMwgglY');

Extract Video Info

$info = $youtube->extractVideoInfo($id);
//or custom client.
$info = $youtube->extractVideoInfo($id, 'android');

Default Client: ios. More clients: ios, android (broken or link expires in 30s), android_vr

Download Video

$download = $youtube->download('song.mp3', 'https://r4---sn-n4v7knll.googlevideo.com/videoplayback?...');
// Or
$youtube->download(file_path, url, max_threads, timeout);

Stream Video

$youtube->stream('https://r4---sn-n4v7knll.googlevideo.com/videoplayback?...');

Releases

No releases published

Packages

No packages published

Languages