Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to download videos using this utility? #184

Open
ivansorlov opened this issue Dec 16, 2023 · 1 comment
Open

How to download videos using this utility? #184

ivansorlov opened this issue Dec 16, 2023 · 1 comment

Comments

@ivansorlov
Copy link

Hi all!
I'm sorry if my question sounds stupid. I'm new to programming.
From the description I did not understand how to use this library.
My task is to download videos to my hosting. Tell me, did I understand correctly that:

1) This code will be enough to download the video?

use YouTube\YouTubeDownloader;
use YouTube\Exception\YouTubeException;

$youtube = new YouTubeDownloader();

try {
    $downloadOptions = $youtube->getDownloadLinks("https://www.youtube.com/watch?v=aqz-KE-bpKQ");

    if ($downloadOptions->getAllFormats()) {
        echo $downloadOptions->getFirstCombinedFormat()->url;
    } else {
        echo 'No links found';
    }

} catch (YouTubeException $e) {
    echo 'Something went wrong: ' . $e->getMessage();
}

2) Is this code written in a PHP script?

3) Where is the video saved in this case?

@NazmulHaque243
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants