Stupid question, but does your service account automatically have access to your youtube account? It is not obvious to me that it would.
I think you may be better off getting credentials via a regular oauth flow, which is what the api explorer does.
Here i have implementd a modified version of the web quickstart from the youtube python api examples, which presents a webview that authorizes to a flask webserver. Then saves the access token to creds.json.
This requires you to add http://localhost:8090/oauth2callback to the allowed callback uris in the developer console.
Also, a bunch of packages need to get installed via stash pip --
google-api-python-client
google-auth
google-auth-oauthlib
google-auth-httplib2
Once you have the token for your user, you can use the google youtube python api. I started with the youtube/api-samples repo on github, replaced their get_authenticated_service with one that uses the saved creds.json.
# Authorize the request and store authorization credentials. def get_authenticated_service(): from oauth2client.client import AccessTokenCredentials creds=json.load(open('creds.json')) credentials= AccessTokenCredentials(access_token=creds['token'],user_agent='JonTestApp') return build(API_SERVICE_NAME, API_VERSION, credentials = credentials)After that, I was able to create a playlist.