Problem/Motivation
I started using this module on the 8.x-1.x branch but it seems the porting of the functionality towards Youtube API V3 was interrupted.
Therefore, the module seems to be unable to perform API calls as a the old, deprecated gdata.youtube.com
URL is still in use.
We can see this because the googleapis Youtube Client is loaded:
public function get(String $source, $id) {
$client = $this->getClientFactory($id);
$youtube = new \Google_Service_YouTube($client); // <----- new V3 client is loaded
But it is not used and instead direct API calls are still used based on a user-provided $source
URL (which seems to be the old gdata.youtube.com
feed:
/**
* Request URL.
*
* @param string $url
* The URL to request.
* @param string $page_token
* The page token for the request.
*
* @return array|null
*/
public function requestUrl($url, $page_token = '') {
try {
$url .= '&maxResults=' . $this->getConfiguration('results_per_page');
$url .= ($page_token != '') ? '&pageToken=' . $page_token : '';
$api_request_result = \Drupal::httpClient()->get($url);
$data = (string) $api_request_result->getBody();
return json_decode($data, TRUE);
}
catch (RequestException $e) {
\Drupal::messenger()->addError($this->t('Request Error: @message', ['@message' => $e->getMessage()]));
}
}
Steps to reproduce
Try to use the module: without the gdata URL it can't work because it won't ever use the youtube API V3.
Proposed resolution
Refactor the Fetcher in order to use the Youtube Client to make calls using the Youtube API V3.
Remaining tasks
Do it.
User interface changes
Instead of inputting a gdata URL, the user should input a Playlist ID. This could be the general, "uploads" playlist ID if the user wants to have all videos.
API changes
TBD
Data model changes
None