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 librariesimport requestsimport pandas as pd# Keysapi_key = "Key generated by Google for me"channel_id = "ID of any YouTube channel I want to explore" # make API callss_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?