YouTube Search is a web application that allows users to search for videos on YouTube and view their subtitles. The application uses the YouTube API to search for videos and the YouTube Transcript API to retrieve the subtitles.
- Python 3.10
- Poetry
- Docker (optional)
Specify env variables in compose.env
file.
For running app in docker use:
make compose
For running app in development mode use:
make run-services
make run-local-app # Run backend
make run-local-celery # Run celery
In this case database is running in a container and app is running locally.
The following environment variables need to be set:
YOUTUBE_API_KEY
: YouTube API keyELASTICSEARCH_HOST
: Elasticsearch host URLELASTICSEARCH_PORT
: Elasticsearch port
Makefile has four targets:
install
: Installs project dependencies using Poetry.compose
: Starts Docker Compose in detached mode.run-services
: Starts services in docker container (Postgres, Redis, Elasticsearch, Kibana), applies database migrations and creates elasticsearch indices. It also copies thecompose.env
file to.env
for environment variable configuration.run-local-app
: Starts FastApi applicationrun-local-celery
: Starts Celery applicationmigrate
: Runs Alembic migration to upgrade the database to the latest revision.
The application provides a REST API with the following endpoints:
Search for videos on YouTube.
Parameters:
q
: Search query (required)lang
: Language code of the subtitles (default: 'en')
Response:
video_id
: ID of the videochannel_id
: ID of the channel that uploaded the videotext
: Subtitle textstart_time
: Start time of the subtitle in secondsduration
: Duration of the subtitle in secondsurl
: URL to the video with the given start time
Index a YouTube channel.
Request body:
{
"channel_urls": ["https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw"]
}
This GitHub Action template automates the build and deployment of a Docker image to a remote server using Ansible.
For proper work of actions you need to specify following secrets for a repository. How to specify secrets: Github docs
The username for authenticating with the Docker registry.
The password or token for authenticating with the Docker registry.
The hostname or IP address of the remote server to deploy the Docker image to.
The SSH private key used to authenticate with the remote server.
The API key used to interact with Youtube API
The FastApi secret key
This project is licensed under the MIT License. See the LICENSE file for details.