This is another option, you can easily do so with the API, something like this:
$client = new KalturaClient($config);
$entry = new KalturaExternalMediaEntry();
$entry->searchProviderType = KalturaSearchProviderType::YOUTUBE;
$result = $client->baseEntry->add($entry, $type);