Closed martindrapeau closed 11 months ago
just came looking for this too
You need to search for it first and then process the results. The channelId will exist in the id result object of the response:
$params = [
'q' => $channel_name,
'type' => 'channel',
'part' => 'id, snippet',
'maxResults' => 5,
'order' => 'title'
];
$search = Youtube::searchAdvanced($params);
Keep in mind that search will use up 100 quota points verses 1 for list. So you could easily hit quota limits if you look up to many accounts this way. https://developers.google.com/youtube/v3/determine_quota_cost
Youtube channel URLs can now have this format: https://www.youtube.com/@hamontsports
How can we extract the channel ID from the @hamontsports part?
Youtube::getChannelByName
fails in this case.