Minute-Mutt
Minute-Mutt is a Golang application designed to help combat YouTube addiction by automatically downloading new videos from subscribed YouTube channels. By using the YouTube API and yt-dlp, Minute-Mutt ensures that you can watch your favorite content without the distractions of the YouTube platform.
Features
- Automatic Downloads: Downloads new videos from your subscribed channels using the YouTube API.
- Local Storage: Saves videos locally, avoiding the need to surf YouTube and potentially get distracted.
- Docker Support: Includes a Dockerfile for easy deployment and a Docker image hosted on Docker Hub (
ash191245141/minute-mutt-cron
).
- Cron Scheduling: Uses cron to schedule regular checks and downloads at specified times (because I have free internet between 12:00 AM and 6:00 AM).
- Customizable Quality: Allows setting the maximum resolution for downloaded videos.
Installation
To use Minute-Mutt, you can either run it locally or use the provided Docker image(recommended).
Local Installation
- Clone the repository to your local machine.
- Ensure you have Golang, yt-dlp, and ffmpeg installed.
- Obtain a
client_secret.json
file for YouTube API authentication:
- Please don't misuse my key, it's a restricted key with a limited quota per day for the free tier
- You can create your own
client_secret.json
by setting up a project in the Google Developers Console and enabling the YouTube Data API v3.
- Alternatively, you can contact me to add your email to the authorized users list. Reach out on Twitter at @ash_sxn or email me at ash.191245141@gmail.com.
- Place the
client_secret.json
file in the root directory of the project.
- Run
go run main.go
and follow the prompts to authenticate with the YouTube API.
- the program will provide you with a link to Google sign-in page, after signing in you'll get an authentication token which you'll need to paste in the program.
- After this I'll search for all the latest videos of your subscribed channels and store them in
pkg/database/history_queue.csv
so we don't download these videos in the future
- when you run the program again It will download the new videos released by the subscribed channels that are not present in
pkg/database/history_queue.csv
.
Docker Installation
- Pull the Docker image from Docker Hub:
docker pull ash191245141/minute-mutt-cron
- Run the Docker container with the required environment variables:
docker run -it -e MAX_RESOLUTION="1080" -e CRON_SCHEDULE="0 0-6 * * *" -v <local-download-location>:/watch ash191245141/minute-mutt-cron:1.0
Replace MAX_RESOLUTION
and CRON_SCHEDULE
with your preferred settings, and replace <local-download-locatoin>
with the directory where you want downloaded videos to be saved, like docker run -it -e MAX_RESOLUTION="1080" -e CRON_SCHEDULE="*/2 * * * *" -v ~/watch:/watch ash191245141/minute-mutt-cron:1.0
will download videos to the ~/watch
directory with 1080p quality and check for new videos every 2 minutes(get familiar with cron to understand this) and download them to the ~/watch
directory if available.
- the program will provide you with a link to Google sign-in page, after signing in you'll get an authentication token which you'll need to paste in the program.
- After this I'll search for all the latest videos of your subscribed channels and store them in
pkg/database/history_queue.csv
so we don't download these videos in the future
- Then you can close the docker container with
ctrl+c
, and then start the container with docker start <cont name>
, and the program will download new videos whenever cron runs the program.
- You can also add
--restart=always
option in your docker run command to always start the docker container after you restart your system
Usage
After installation, Minute-Mutt will automatically check for new videos from your subscribed channels based on the CRON_SCHEDULE. Downloaded videos will be saved to the specified output directory.
Configuration
MAX_RESOLUTION
: Sets the maximum resolution for downloaded videos (e.g., "1080").
CRON_SCHEDULE
: Defines when the program should check for and download new videos (e.g., "*/2 * * * *").
OUTPUT_DIR
: Sets the directory where downloaded videos will be saved (default is /watch
in the Docker container).
Logs
Logs are saved to /var/log/cron.log
in the Docker container, which includes any errors encountered during the download process.
Contributing
Contributions to Minute-Mutt are welcome. Please feel free to fork the repository, make changes, and submit a pull request.
License
Minute-Mutt is released under the MIT License. See the LICENSE file for more details.
Acknowledgments
- yt-dlp: Command-line program to download videos from YouTube and other video sites.
- YouTube API: API services provided by YouTube for programmatic access to YouTube content.