Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Uploading a video to Youtube from an AWS lambda

$
0
0

I need to upload video to YouTube from an AWS Lambda.The Lambda will be written in Python3(.9)

I first tried locally the upload_video.py sample code provided here that I converted to Python3I retrieved the OAUTH client_secrets.json as explained in the doc and when I launch the script it prints an URL in the console that I'm supposed to enter in the browser to retreive a validation code.

But as my code will run unattended inside a lambda, there will be no-one to use that URL.

Is it possible to upload a video to YouTube using an API Key instead ?I can't seem to find how the sample should be modified to use an API Key instead of this interactive validation.

The part of the sample code that currently deals with the authentication is below.

Thanks

from apiclient.discovery import buildfrom oauth2client.client import flow_from_clientsecretsfrom oauth2client.file import Storagefrom oauth2client.tools import run_flowdef get_authenticated_service(args):  flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE,    scope=YOUTUBE_UPLOAD_SCOPE,    message=MISSING_CLIENT_SECRETS_MESSAGE)  storage = Storage("%s-oauth2.json" % sys.argv[0])  credentials = storage.get()  if credentials is None or credentials.invalid:    credentials = run_flow(flow, storage, args)  return build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,    http=credentials.authorize(httplib2.Http()))

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>