To retrieve the YouTube video metadata our plugin makes use of the YouTube Data API. We have a our own API key that’s shared between all of our users, but it’s also possible to set your own personal key instead.
Our shared key might hit the daily limit, preventing the YouTube video metadata from showing up, which is why you might want to set your own instead.
Creating your own YouTube Data API key
Start by creating a new project over at https://console.developers.google.com/projectcreate
Next, click on “Enable APIs and services” and search for and select the “YouTube Data API”.
Click the “Enable” button on the next screen:
Next, click the “Create Credentials” button.
Make the following selections and click on “What credentials do I need?”:
You will find the API key on the next screen:
After generating, you’ll also be able to find this same key by going to https://console.developers.google.com/apis/credentials
You can ignore the request for an “OAuth consent screen” after creating your key.
Setting your own YouTube Data API key
Now that you have your own API key there’s only 1 easy step left: go to the WP Recipe Maker > Settings > Recipe Metadata page and paste the key you’ve generated above into the “Personal YouTube Data API key” setting.
Refreshing the Video Metadata
If you were having trouble with the video metadata for YouTube videos setting your own personal API key might solve things. To confim immediately, use the “Refresh Video Metadata” button on the WP Recipe Maker > Tools page to force an update of that metadata (this is usually only done once per week).
After that, clear any caching plugins you might be using on your website and use Google’s Structured Data Testing Tool to check.
Troubleshooting your Personal API Key
If you’re still experiencing issues with the YouTube video metadata, your personal API key might not be set up correctly. When in the Google Cloud Console, go to the “Enabled APIs & services” section to check your error rate:
In the screenshot above there’s an error rate of 100%, for example. So that means the requests are reaching Google, but there are some problems preventing the metadata from actually being returned.
A few things to check on Google’s end:
- Do you have a billing account set up and associated with this project?
- If you just use it for getting metadata for your videos you won’t incur charges, but make sure to set up a budget through the “Billing” section to get notified if that does happen
- Are there restrictions set up for the API key?
- If it’s limited to a specific domain, make sure that’s set up correctly and reflects where the API calls are coming from
- If unrestricted, make sure you track billing as the API key could be used by anyone, if fallen into the wrong hands