migrate_youtube
Migrate Youtube
INTRODUCTION
This module provides a set of two migrate source plugin to migrate Youtube videos and playlists.
REQUIREMENTS
This module requires the following module:
* Migrate - https://www.drupal.org/project/migrate
* Migrate Plus - https://www.drupal.org/project/migrate_plus
RECOMMENDED MODULES
* Migrate Tools - https://www.drupal.org/project/migrate_tools
CONFIGURATION
1. In your local settings.php file, add your Youtube API key as follow:
$settings['youtube_api_key'] = 'your-own-1234567-API-KEY-here';
Migrating videos
Use the 'migrate_youtube_api_playlist_items' source plugin to retrieve videos,
you can pass any Youtube playlist ID as migrate source.
source:
plugin: migrate_youtube_api_playlist_items
playlist_id: youtube-account-playlist-id
Every youtube account has a main playlist containing all its videos (https://developers.google.com/youtube/v3/docs).
Because of API calls limitations with your key, this source tries to be as
efficient as possible.
Additional calls are needed to retrieve video duration, if needed, set the
contentDetails key to true
source:
plugin: migrate_youtube_api_playlist_items
playlist_id: whatever-playlist-id-here
contentDetails: true
Then add the duration to your destination as follow
process:
...
field_duration: duration
See the provided example in migration_examples/youtube_video_to_media.yml
Playlist migration is also available.
Learn more about this module's (source fields, maintenance) in its README.md file.