Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Youtube Data API - Get private and unlisted Playlists

$
0
0

In a Laravel app, I am trying to get the playlists associated to my YouTube channel.These playlists can be either public, private or unlisted.

I can retrieve public playlists but I am stuggling to get the unlisted and private ones, even with oAuth configured.

Here is my code

public function getPlaylist()    {        $client = new Client();        $client->setLogger(new \Monolog\Logger('google-api'));        $client->setApplicationName('Playlists');        $client->setAuthConfig(base_path('youtube.json'));        // Exchange authorization code for an access token.        if (Session::has('google_oauth_token')) {            $client->setAccessToken(Session::get('google_oauth_token'));        }        $service = new YouTube($client);        $queryParams = ['channelId' => config('scraper.channelId'),'maxResults' => 50,'mine' => 1,        ];        $response = $service->playlists->listPlaylists('snippet, contentDetails, status,id', $queryParams);        dd($response);    }

I get the following error:{ "error": { "code": 400, "message": "Incompatible parameters specified in the request: channelId, mine", "errors": [ { "message": "Incompatible parameters specified in the request: channelId, mine", "domain": "youtube.parameter", "reason": "incompatibleParameters", "location": "parameters.", "locationType": "other" } ] } }

When I remove the mine parameter. I get the public playlists.If I keep the mine parameter and remove the channelId, I get this error:{ "error": { "code": 404, "message": "Channel not found.", "errors": [ { "message": "Channel not found.", "domain": "youtube.playlist", "reason": "channelNotFound", "location": "channelId", "locationType": "parameter" } ] } }

What am I doing wrong ? Is this even possible to get private and unlisted playlists?

Thank you for your assistance on this


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>