Youtube icon indicating copy to clipboard operation
Youtube copied to clipboard

Add Get Channel By Handle

Open j33tmane opened this issue 1 year ago • 1 comments

Copy this function inside your YouTub.php to search channel by there handle name

public function getChannelByHandle($handleName, $optionalParams = [], $part = ['id', 'snippet', 'contentDetails', 'statistics'])
    {
        $API_URL = $this->getApi('channels.list');
        $params = [
            'forHandle' => $handleName,
            'part' => implode(',', $part),
        ];

        $params = array_merge($params, $optionalParams);

        $apiData = $this->api_get($API_URL, $params);

        return $this->decodeSingle($apiData);
    }

j33tmane avatar Feb 04 '24 17:02 j33tmane

@j33tmane if you found this method useful you can add it to the project, PRs are always welcome ;)

alaouy avatar Feb 07 '24 19:02 alaouy