A diagram of the cloud architecture

Making a YouTube audio downloader using AWS cloud

Aug 2023
Coding

The goal

I wanted to create an easy and quick way to download the audio files from YouTube video for my own use and playing offline. I wanted to be able to go to a video page and just click download. I decided to leverage the cloud to do this.

Why the cloud

I have been recently learning about AWS cloud services and wanted to put them into practice. I also wanted to reduce the reliance of having code run on the device I am using and the network connection I have at the time.

Solution

Browser extension

I created a browser extension that checks the current tab url to see if it is a YouTube video, If it is there is a download button is enabled which makes a request to an AWS API Gateway url to trigger a download.

Authentication

To reduce the risk of anyone being able to trigger downloads I implemented a basic authentication system which has an expected value which must be provided in the header of all requests.

Trigger

If authenticated then a lambda function checks there is a url in the request body and adds a message to an SQS queue to download the audio on that page.

Downloader

Another lambda function is triggered for messages in the queue which actually downloads the audio, uploads it to an S3 bucket and publishes an SNS message with a 1 week valid presigned download url. I have subscribed to the SNS topic and receive an email for every completed download.

If you have any questions please feel free to reach out.

Links

project repo