I'm following these instructions:https://developers.google.com/youtube/v3/quickstart/python
I have created an API key in Google Cloud Apis and Services (Api key application restrictions is set to NONE, and API restrictions set to DONT RESTRICT KEY. I have also created a OAuth 2.0 Client IDs. Both under the same project, which has YouTube Data API v3 enabled from the API library.
When I follow the instructions (link above):
In the sample that you downloaded, find the YOUR_API_KEY string and replace that with the API key that you created in step 1 of this quickstart.
That text is not present in the code (pasted below), as you can see.
What am I doing wrong!! This is the first time I've tried doing anything like this, so might be something really obvious, but I cant find the solution.
# -*- coding: utf-8 -*-# Sample Python code for youtube.channels.list# See instructions for running these code samples locally:# https://developers.google.com/explorer-help/code-samples#pythonimport osimport google_auth_oauthlib.flowimport googleapiclient.discoveryimport googleapiclient.errorsscopes = ["https://www.googleapis.com/auth/youtube.readonly"]def main(): # Disable OAuthlib's HTTPS verification when running locally. # *DO NOT* leave this option enabled in production. os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" api_service_name = "youtube" api_version = "v3" client_secrets_file = "YOUR_CLIENT_SECRET_FILE.json" # Get credentials and create an API client flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file( client_secrets_file, scopes) credentials = flow.run_console() youtube = googleapiclient.discovery.build( api_service_name, api_version, credentials=credentials) request = youtube.channels().list( part="snippet,contentDetails,statistics", id="UC_x5XG1OV2P6uZZ5FSM9Ttw" ) response = request.execute() print(response)if __name__ == "__main__": main()I'm expecting to follow these instructions, but without the text YOUR_API_CODE in the script, I can't continue
From : https://developers.google.com/youtube/v3/quickstart/python
Copy the code sample and save it in a file named example.py.
In the sample that you downloaded, find the YOUR_API_KEY string and replace that with the API key that you created in step 1 of this quickstart.
Run the sample from the command line. In your working directory, run:
python example.py
The sample should execute the request and print the response to STDOUT.