Integrating the GitHub action to make yt-dlp-api tests automated!
peter279k - May 15 '23 - - Dev Community
What I built
- I developed a YouTube API service with the yt-dlp and Fast-API and it can give the YouTube video link to extract the video information.
Category Submission
- The category is for the DIY deployments.
App Link
Screenshots
The demonstration website is as follows:
The Swagger API doc website is as follows:
Description
The simple yt-dlp-api server is to extract YouTube video URL easily.
Link to Source Code
The simple yt-dlp-api server to extract YouTube video URL easily
yt-dlp-api
Introduction
The simple yt-dlp-api server is for extracting YouTube video information with YouTube video URL.
Usage
- Preparing the Linux-like operating system.
- Preparing the
Python 3.7+
version in the operating system.
- Install the
pipenv
with running the pip3 install -U pipenv
command.
- Running the
pipenv install
to create the virtual environment.
- Modifying the
yt-dlp-api.service
file with the yt-dlp-api.service.example
file.
- Copying the
yt-dlp-api.service
file to the /etc/systemd/system/
folder.
- Running the
sudo systemctl daemon-reload
to reload the systemd daemon.
- Running the
sudo systemctl enable --now yt-dlp-api.service
to enable and start the service.
- Enjoy it!
Tips
- Sometimes the
yt-dlp
are updated frequently and it can run the pipenv run pip install -U yt-dlp
command to upgrade this package and run the systemctl restart yt-dlp-api.service
command to restart the daemon service.
Permissive License
The open source project is under the MIT license.
The LICENSE details is available here.
Background
My aunt likes to watch the Japanese music video and she wants to use the video to make her own music video.
However, many on-line YouTube video downloader websites are not convenient for people because they contain some advertisements. And she usually clicks the wrong place before downloading the YouTube video via the website.
Due the above reason, I determine developing the YouTube video downloading website and it can resolve the above issue currently.
How I built it
- For integrating the GitHub action setting, it's available here.
- I use the GitHub action to setup the Python 3.8 environment and make some tests automated with pytest.
I use the following techniques to complete above website development:
- Python 3.8+
- FastAPI
- Bootstrap 4
I use the following techniques to complete the unit tests:
- pytest
- pytest-mock
- Fast API testing
I learn how to use above packages to complete unit tests. And it includes mocked test approaches.
Additional Resources/Info
Here are some useful references I found and it's helpful for me to complete this open source project: