Skip to content
/ y2 Public

Automate yt-dlp downloading, storing, checking for duplicates and watching videos using mpv (or alternatives) with concise commands.

License

Notifications You must be signed in to change notification settings

FrostyNick/y2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

y2

Bash Code Size License

Automate yt-dlp downloading, storing, checking for duplicates and watching videos using mpv, vlc, or an alternative with concise commands.

Table of Contents

Dependencies

You will need the following dependencies installed on your system:

  • bash
  • coreutils - If you don't know what this means, you probably have it.
  • yt-dlp (default) or youtube-dl (for downloading videos)
  • mpv (default), cvlc, vlc or alternative for viewing videos (for viewing videos)
  • fzf (to be optional in the future; for interactive selection)

Installation

  1. Clone the repository:
cd ~/projects
git clone https://github.com/FrostyNick/y2.git

Note

ln needs to be used again (as shown later) if y2 is moved. Pick a place you don't plan to move it out of right away.

  1. Make the script executable:
chmod +x ./y2/y2.sh
  1. Add it to path so it can be run anywhere. To see where your path(s) are: echo $PATH
# Check that /usr/local/bin is in $PATH otherwise below will not work.
sudo ln -s $HOME/projects/y2.sh /usr/local/bin/y2
# For example, if choosing ~/.local/bin instead if above is not found in $PATH:
sudo ln -s $HOME/projects/y2.sh $HOME/.local/bin/y2
  1. Check that it runs.

y2 --help

Usage

See y2 --help for the latest help.

y2 [options] <media_url>

Examples

  1. Download a video and save it in filestore.
y2 https://youtu.be/pVI_smLgTY0
  1. (yt-dlp only maybe) Download a video like above with recommended added options and a max video height:
y2 0 720 https://youtu.be/pVI_smLgTY0

The 0 above (without second argument) at the time of writing is replaced with: -f bestvideo[height<=1080]+bestaudio/best[height<=1080] --embed-chapters --sponsorblock-mark all --embed-metadata --embed-thumbnail --add-metadata --embed-subs --sub-lang en

  1. Download a video with height no bigger than 500px (this is comparable to quality settings in YouTube video); adding some flags from yt-dlp as well:
y2 500 --dateafter today-2weeks https://www.youtube.com/watch?v=xsDnEj2Hx4Q
  1. Get video. This will work if it's in the filename.
y2 -g pVI_smLgTY0

Options

  • -h or --help or empty: Get help.
  • -g: Get downloaded video(s) using grep and fzf. Tested to work on YouTube videos.
  • 0: Apply extra flags to the filefetch (yt-dlp; might work with youtube-dl).
  • <int> != 0: Set a maximum video height size.
  • --max <int>: Same as above.

Every other flag that is not recognized will be passed to filefetch.

Configuration

You can customize the following settings in the start of the script:

  • filefetch: Set to yt-dlp (default) or youtube-dl.
  • fileview: Set to mpv (default) or other media players.
  • filestore: Default storage location for downloaded videos ($HOME/y2).
  • filecache: Default cache location ($HOME/.cache/y2).

Warning

This may be moved to $HOME/.config in the future.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

This project is licensed under the UNLICENSE License. See the UNLICENSE file for details.

About

Automate yt-dlp downloading, storing, checking for duplicates and watching videos using mpv (or alternatives) with concise commands.

Topics

Resources

License

Stars

Watchers

Forks

Languages