Skip to content

poseidon-code/ytmp3-dl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ytmp3-dl ytmp3-dl usage

A python script that uses yt-dlp (fork of youtube-dl) to download the audio from any YouTube video/audio link while executing the program, and converts it to .mp3 format of high quality. Downloads are done in a multithreaded way, so faster downloads ⚡.


Table Of Contents

  1. General Usage
  2. Options
  3. Usage
  4. Building
  5. Credits
  6. License

General Usage

$ ytmp3-dl https://youtu.be/dQw4w9WgXcQ

You can download set up ytmp3-dl as you wish (see: script-like, release build usage)

You can build ytmp3-dl for your specific system. Check out build usage and entire Building section to build your version of ytmp3-dl and how to use it more effectively.

Pass some options to customise your downloads. (see: Options)

Options

You can pass command line options and flags to ytmp3-dl.

OPTIONS USAGE EXAMPLE
-d, --dir path set download directory $ ytmp3-dl -d ~/Music/ <url>
-f, --ffmpeg path set the exact path to ffmpeg $ ytmp3-dl -f ~/.local/bin/ffmpeg <url>
-l, --limit number set concurrent download limit $ ytmp3-dl -l 4 <url>
FLAGS USAGE EXAMPLE
-h, --help list available options $ ytmp3-dl -h

Script Like Usage

(make sure Python and pip are both installed on your system)

  • Download ytmp3-dl script file only
    $ curl -LJO https://raw.githubusercontent.com/poseidon-code/ytmp3-dl/main/ytmp3-dl.py
  • Make ytmp3-dl executable
    $ chmod +x ytmp3-dl.py
  • Install yt-dlp (using pip) and ffmpeg (using your OS's package manager; here: pacman)
    $ pip install yt-dlp
    $ sudo pacman -S ffmpeg
  • You are done here 🍵. Additionally you can set the script to global $PATH and use it from there.
    (check out General Usage on how to use the script)

Release Build Usage

The builds of this program is available for 64-bit versions of Linux and Windows Operating Systems (macOS users can download the source code and build it by themselves, see build instructions). These build does not require one to have python (and even ffmpeg) installed. You can download them from here.

[-base-]: Base Version
This version does not includes ffmpeg binaries, and relies on ffmpeg which is already installed in the user's Operating System. (Download & Install ffmpeg)

[-essentials-]: Essentials Version
This version comes with compatible ffmpeg binaries, and does not relies on ffmpeg being installed on the Operating System. (i.e. If you don't want to go with the hassel of downloading, installing, setting PATH for ffmpeg, then go with this version.)

Build Usage

You can build ytmp3-dl for your specific system. Check out entire Building section to build your version of ytmp3-dl and how to use it more effectively.

Building

To build ytmp3-dl for your system follow these instructions :
Prerequisites : (currently tested with these configs only, earlier versions may work too, but no guarantees ;__;)

  • python >=3.9
  • pip >=21.2.4
  • pyinstaller >=4.7

Setup Python Virtual Environment

  • Inside the project directory, initialise venv, activate it and ensure pip :
    $ python -m venv env
    $ . ./env/bin/activate
    $ python -m ensurepip
  • Install pyinstaller
    $ pip install pyinstaller
  • Install ytmp3-dl dependencies :
    $ pip install -r requirements.txt

Start Building

$ pyinstaller --onefile ytmp3-dl.py

Post Building

  • After building finishes, the actual executable will be at dist/ directory. You can always export the ytmp3-dl binary path to your shell. Or can make an alias for your shell. (check on setting $PATH, inside Personal Build Usage below)

    # inside .bashrc can either of the following lines
    
    # exporting to PATH
    export PATH=$PATH:/path/to/ytmp3-dl/directory/
    
    # OR, setting alias 
    alias ytmp3='/exact/path/to/ytmp3-dl'
  • You can also Copy-Paste the ytmp3-dl binary from dist/ after building to ~/.local/bin/ directory, and make sure you have this directory exported to your shell's $PATH variable (i.e export PATH=$PATH:$HOME/.local/bin).

Personal Build Usage
Since you have build your own ytmp3-dl binary for your system, it is also required to have ffmpeg installed in your system by your OS's package manager (i.e.: sudo pacman -S ffmpeg for Arch Linux and so on, check for your specific OS).

Otherwise you could download the ffmpeg binary from here and set it to $PATH
(check: How to set $PATH for Linux, MacOS & Windows)

Credits


License

MIT License

© poseidon-code 2021

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.