'Missing a Valid API Key for Youtube Data API v3 using Python
I was trying to work with the Youtube API to collect video statistics from a channel (that I don't own) using the requests python library to make an API call and save it as a pandas dataframe.
# Import libraries
import requests
import pandas as pd
# Keys
api_key = "Key generated by Google for me"
channel_id = "ID of any YouTube channel I want to explore"
# make API call
ss_url = "https://www.googleapis.com/youtube/v3/search?key="+api_key+"&channelId="+channel_id+"&part=snippet,id&order=date&maxResults=500"
ss_response = requests.get(ss_url).json()
ss_response
Each time I execute the above Python code it returns the following message:
{'error': {'code': 403,
'errors': [{'domain': 'global',
'message': 'The request is missing a valid API key.',
'reason': 'forbidden'}],
'message': 'The request is missing a valid API key.',
'status': 'PERMISSION_DENIED'}}
Can anybody help me resolve this error, please?
Solution 1:[1]
It seems there is a problem with your API Key, Check if your API key is validated, sometimes it takes time. Re-send api key request and try a new one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yoni Bitew |
