• 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.

  • This, or when you're on a connection that is a bit too slow or unreliable for streaming. In that case it's nicer to download a video in the background for a while, so you can watch it uninterrupted afterwards, without having to wait for it to buffer every few minutes.

Internal error.

Oops! Looks like something went wrong!