An AWS Lambda function to fetch a YouTube transcript.
- Install the
serverless-python-requirements
plugin if you don't have it already.
pnpm install serverless-python-requirements
- Install the
serverless-plugin-resource-tagging
plugin if you don't have it already.
pnpm install serverless-plugin-resource-tagging
- Install the
serverless-functions-base-path
plugin if you don't have it already.
pnpm install serverless-functions-base-path
- Set the following environment variables (Everything except the OpenAI API key are already set in the
.env.sample
file. To use this file, rename it to.env
with the following command
mv .env.sample .env
For a brief explanation of each environment variable, see below:
-
SERVICE_NAME: The name of the service (default: youtube-transcript-service-v1)
-
LOG_LEVEL: Logging level (default: DEBUG).
-
USE_PROXY: Use a proxy to fetch the transcript (default: false).
-
PROXY_USERNAME: The username for the proxy (default: none).
-
PROXY_PASSWORD: The password for the proxy (default: none).
-
Update
serverless.yml
to include theserverless-python-requirements
plugin. -
Update
serverless.yml
to include theserverless-plugin-resource-tagging
plugin. -
Update
serverless.yml
to include theserverless-functions-base-path
plugin. -
Update the 'service' of the service in
serverless.yml
to your desired service name. -
Logging is configured in
src/utils/logger.py
to output to stdout. This should work on AWS CloudWatch.
serverless deploy