Coder Social home page Coder Social logo

youtube-dnd's Introduction

youtube-dnd

Bash function for yt-dlp with drag and drop capability.

Usage

Type yt in terminal and press Enter key then drag and drop url from your web browser into terminal to download the video. There is not need to type command and press Enter with each new link.

You can paste next url as soon as last download is finish (you will see [download] 100% and empty new line in terminal). It is possible to paste new url while last one is still in progress, but if you add more than one, download will fail (all urls will be treated as one).

To terminate process press Ctrl+C or simply close the terminal.

Installation

Install yt-dlp and make sure it is working properly (e.g. try executing yt-dlp --version).

To add function for your user (Linux, macOS, etc.): To install it right away for all UNIX users (Linux, macOS, etc.), type:

sudo curl -L https://raw.githubusercontent.com/lukdz/youtube-dnd/master/yt -o /usr/local/bin/yt
sudo chmod a+rx /usr/local/bin/yt

Alternatively you can add content of bash_function file from this repository to ~/.bash_aliases on Ubuntu or ~/.bash_profile on macOS.

Options

Default program used to process URLs is yt-dlp with --update argument on startup. This can be changed by setting environmental variable with name of selected program and option. To make changes persistent add the following example to ~/.bash_aliases file on Ubuntu or ~/.bash_profile on macOS.

youtube

export YT_DOWNLOADER="yt-dlp"
export YT_DOWNLOADER="youtube-dl"
# for macOS to avoid issues with python version
export YT_DOWNLOADER="/usr/bin/python3 /usr/local/bin/youtube-dl"

wkhtmltopdf

It possible to modify the link before passing them to command line tool for example to use with wkhtmltopdf to render HTML into PDF:

wkslug () {
    wkhtmltopdf \
        "$1" \
        "$(echo "$1" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z).pdf"
}
export -f wkslug
export YT_DOWNLOADER="wkslug"
export YT_START_ARG=${YT_START_ARG:---version}

Issues

  • adding third link while first one is downloading, causes second and third to merge together fixed by running downloader in the background
  • read function is broken on zsh read function on zsh uses -k option instead of -n

External links

youtube-dnd's People

Contributors

lukdz avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.