As of December 2023, the YouTube API still doesn't have an endpoint that supports pulling channel data by handle.
Using PHP, I did find a bit of a workaround.
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\HttpClient\HttpClient;
public function getChannelIDFromUrl($url) {
$httpClient = new HttpBrowser(HttpClient::create());
$crawler = $httpClient->request('GET', $url);
$channelUrl = $crawler->filterXPath('//meta[@property=\'og:url\']')
->attr('content');
return explode('/', $channelUrl)[4];
}
Note: $url returns a string with the @ handle in it.
channel -> snippet -> customUrl
). – Boast