Code Monkey home page Code Monkey logo

minute-mutt's Introduction

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

  1. Clone the repository to your local machine.
  2. Ensure you have Golang, yt-dlp, and ffmpeg installed.
  3. 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 [email protected].
  4. Place the client_secret.json file in the root directory of the project.
  5. Run go run main.go and follow the prompts to authenticate with the YouTube API.
  6. 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.
  7. 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
  8. 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

  1. Pull the Docker image from Docker Hub: docker pull ash191245141/minute-mutt-cron
  2. 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.

  1. 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.
  2. 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
  3. 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.
  4. 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.

minute-mutt's People

Contributors

ash-sxn avatar

Stargazers

Prajyot avatar

Watchers

 avatar

Forkers

jmmeessen stazz0

minute-mutt's Issues

Way to block the youtube main website but still use the yt-dlp to download videos

  • this will help to block YouTube altogether and still use yt-dlp to download videos so users can only interact with YouTube with the project and not with the main website
  • I usually use to edit /etc/hosts and add a 127.0.01 www.youtube.com file in my Ubuntu machine to block YouTube but it also blocks yt-dlp from accessing the YouTube site to download from
  • we'll need some sort of network proxy to make it so that the project or docker container can access youtube but not the user

Deal with the open `client_secret.json`

  • having an open secret like this is a security risk
  • I have restricted its use to only YouTube data v3 API and it also has a daily limit of about 10000 units, which gets reached pretty easily on heavy usage
  • but If I remove the secret from here my friends won't be able to use the application(those who don't know how to create their own key) so I am keeping it from right now
  • In future maybe we can have a solution for this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.