youtube-tui

Shell scripts to query YouTube from a terminal.
git clone git://git.concealed.world/youtube-tui
Log | Files | Refs | README | LICENSE

commit 5bfe320f7d6e24028b1b87cfac184ddb4d7ca68e
parent 5b126fa06ac224f81aa6c8e38c59c77019b67df8
Author: Nixx <nixx@firemail.cc>
Date:   Thu, 24 Feb 2022 22:10:24 +0000

--script-opts no longer needed

Diffstat:
Mytchannel | 12+++++++++---
Mytsearch | 3+--
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/ytchannel b/ytchannel @@ -1,6 +1,6 @@ #!/bin/bash # A companion piece for ytsearch. Allows you to find the channel of videos, to use in RSS feed. -# DEPENDS: youtube-dl, xclip, coreutils +# DEPENDS: youtube-dl/yt-dlp, xclip, coreutils # # Copyright (C) <2020> <nixx@firemail.cc> # @@ -43,7 +43,7 @@ find "${1}" > /dev/null 2>&1 tmp=$(mktemp) origurl=$(echo "${1}" | rev | cut -d \. -f 2 | cut -c 1-11 | rev) -youtube-dl -f worstaudio "https://www.youtube.com/watch?v=${origurl}" -o "%(title)s-%(channel_id)s.%(ext)s" > $tmp +${downloader} -f worstaudio "https://www.youtube.com/watch?v=${origurl}" -o "%(title)s-%(channel_id)s.%(ext)s" > $tmp url=$(cat $tmp | grep "Destination" | head -n 1 | rev | cut -d \. -f 2 | cut -c 1-24 | rev) fullurl="https://www.youtube.com/feeds/videos.xml?channel_id=${url}" @@ -60,7 +60,7 @@ link () { origurl=$(echo "${1}" | rev | cut -c 1-11 | rev) tmp=$(mktemp) -youtube-dl -f worstaudio "https://www.youtube.com/watch?v=${origurl}" -o "%(title)s-%(channel_id)s.%(ext)s" > $tmp +${downloader} -f worstaudio "https://www.youtube.com/watch?v=${origurl}" -o "%(title)s-%(channel_id)s.%(ext)s" > $tmp url=$(cat $tmp | grep "Destination" | head -n 1 | rev | cut -d \. -f 2 | cut -c 1-24 | rev) fullurl="https://www.youtube.com/feeds/videos.xml?channel_id=${url}" @@ -77,6 +77,12 @@ rm $tmp [[ $1 == '-h' || $1 == '--help' ]] && message && exit 0 [[ $# != 2 ]] && message && exit 1 +if [[ $(which yt-dlp > /dev/null 2>&1) ]]; then + downloader="youtube-dl" +else + downloader="yt-dlp" +fi + case "$1" in --file) file "${2}" && exit 0 ;; --link) link "${2}" && exit 0 ;; diff --git a/ytsearch b/ytsearch @@ -473,11 +473,10 @@ fi [[ -n $configf && -n $(grep "s_timeout" "${configf}") ]] && timeout=$(grep "s_timeout" "${configf}" | awk '{print $3}') || timeout=20 [[ -n $configf && -n $(grep "s_format" "${configf}") ]] && vformat=$(grep "s_format" "${configf}" | awk '{print $3}') +player="mpv" if [[ $(which yt-dlp > /dev/null 2>&1) ]]; then - player="mpv" downloader="youtube-dl" else - player="mpv --script-opts=ytdl_hook-ytdl_path=yt-dlp" downloader="yt-dlp" fi