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

Cannot access protected property videoDetails #176

Open
surazdott opened this issue Jun 26, 2023 · 0 comments
Open

Cannot access protected property videoDetails #176

surazdott opened this issue Jun 26, 2023 · 0 comments

Comments

@surazdott
Copy link

surazdott commented Jun 26, 2023

Cannot access protected property YouTube\Models\VideoDetails::$videoDetails

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

    if ($downloadOptions->getAllFormats()) {
        $info = $downloadOptions->getInfo();

        echo $info->videoDetails['title'];
    } else {
        echo 'No links found';
    }

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

When we need additional information and call $videoDetails property of video we get an error.

For solution i changed this code inside YouTube\Models\VideoDetails;

public $videoDetails = array();

public function __construct($videoDetails)
{
    $this->videoDetails = $videoDetails;
}
@surazdott surazdott reopened this Jun 26, 2023
@surazdott surazdott reopened this Jun 26, 2023
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

1 participant