Import YouTube Videos


Frontend Dashboard Screen

Create Google OAuth Project

Your app may need to be verified. Follow the Manage OAuth App Branding guide for further instructions https://support.google.com/cloud/answer/15549049?sjid=17774368760552836686-NC


The YouTube Importer screen is displayed for administrators by default. To grant access to regular members, follow these steps:

  1. Navigate to your Frontend Dashboard > Settings > Capabilities.

  2. Select "Post Type: YouTube Importer".

  3. Choose a specific user role to grant permissions to, or select "All" to apply changes to all roles.

  4. Check the necessary capability checkboxes.

For more information about Content Capablities, please refer to Content Capabilities


Backend Screen - Add An Importer


Navigate to Videos > YouTube Importers > Add New

  1. Add Title: Enter a custom title for the importer, for example: My Music

  2. Enable: Enable the importer in case of running automatically via hosting Cron Job

  3. Youtube API Key : Enter your own Youtube API key

  4. Search: Specifies the query term to search for. Your request can also use the Boolean NOT (-) and OR (|) operators to exclude videos or to find videos that are associated with one of several search terms. For example, to search for videos matching either "boating" or "sailing", set the search field value to boating|sailing. Similarly, to search for videos matching either "boating" or "sailing" but not "fishing", set the search field value to boating|sailing -fishing.

  5. Channel/Playlist ID: The field value indicates that the API response should only contain resources created by the channel.

  6. Max Results Specifies the maximum number of items that should be returned in the result set. Acceptable values are 0 to 50

  7. Event Type: Restricts a search to broadcast events

  8. Video Type: Restrict a search to a particular type of videos

  9. Safe Search: Indicates whether the search results should include restricted content as well as standard content.

  10. Video Definition: Restrict a search to only include either high definition (HD) or standard definition (SD) videos. HD videos are available for playback in at least 720p, though higher resolutions, like 1080p, might also be available

  11. Video Dimension: Restrict a search to only retrieve 2D or 3D videos

  12. Video Duration: Filters video search results based on their duration

  13. Video License: Filters search results to only include videos with a particular license. YouTube lets video uploaders choose to attach either the Creative Commons license or the standard YouTube license to each of their videos.

  14. Published After: Indicates that the API response should only contain resources created at or after the specified time

  15. Published Before: Indicates that the API response should only contain resources created before or at the specified time

  16. Region Code: Instructs the API to return search results for videos that can be viewed in the specified country

  17. Relevance Language: Instructs the API to return search results that are most relevant to the specified language

  18. Video Categories: Choose the video categories the videos will be imported to

  19. Video Tags: Choose the video tags the videos will be imported to

  20. Import Tags: Imports video keywords

You can add many importers as you wish


Authenticate with Google OAuth

Navigate to Customize > Theme Options > Google OAuth and provide your Google Client ID and Google Client Secret keys.

See "Implementing OAuth 2.0 Authorization" for further instructions https://developers.google.com/youtube/v3/guides/authentication

Your Google OAuth App must have "YouTube Data API v3" enabled for proper functionality.

Assign Capabilities

For detailed instructions on assigning capabilities, please refer to Content Capabilities

  1. Select the "Post Type: YouTube Importers".

  2. Choose a specific user role to grant permissions to, or "All" to retrieve all roles.

  3. Check the necessary capability checkboxes.

YouTube Importers Capabilities

Create A YouTube API Key (deprecated)

Since version 4.x, creating an API key is no longer necessary, as authentication is now handled through OAuth. OAuth provides a more secure and user-friendly way for users to connect their accounts directly without manually entering API keys.


Manual Import


Auto Import Using Hosting Cronjob (deprecated)


Copy the CronTab URL of Importer and set it up in your Hosting Panel

For example, with DreamHost hosting

Command

wget http://domain.com/youtube_importer/my-music/?key=123456789

OR

curl 'http://domain.com/youtube_importer/my-music/?key=123456789'


Auto Import Using WP Control Plugin (deprecated)

  • Install and Activate WP Control plugin https://wordpress.org/plugins/wp-crontrol/

  • Navigate to Tools > Cron Events > Add New

  • Choose and fill in the necessary fields and click the "Add Event" button.

    file_get_contents( 'your crontab url' );


Filter Post Arguments

Example code snippet to modify WP video post date based on YouTube-formatted date before inserting into the database.

Last updated