youtube-tui

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

commit d4c78d511952b0f94d5f8afb8e4defead36af0e4
parent eeeb9da603bc6bbeaf76d9bd270222c8084fd417
Author: Nixx <nixx@firemail.cc>
Date:   Sun,  1 Aug 2021 17:23:20 +0100

Updated for newer versions of Invidious

Diffstat:
Mexample-config-file/ytsearch | 6+++---
Mytsearch | 9+++++++--
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/example-config-file/ytsearch b/example-config-file/ytsearch @@ -1,9 +1,9 @@ -#https://yt.iswleuven.be/ -#https://invidious.13ad.de/ #https://invidious.snopyta.org/ +#https://invidious.13ad.de/ #https://vid.mint.lgbt/ #https://invidious.tube/ +#https://invidious.fdn.fr/ s_website = https://invidious.snopyta.org/ s_results = 10 s_format = 22/18/best -s_timeout = 20 +s_timeout = 5 diff --git a/ytsearch b/ytsearch @@ -133,7 +133,7 @@ line process () { countto=$3 [[ -z $countto ]] && countto=9999 - links=$(cat "${1}" | grep -n '<a href="/watch?v=\|<a style="width:100%" href="/playlist?list=') + links=$(cat "${1}" | grep -n '<a style="width:100%" href="/watch?v=\|<a style="width:100%" href="/playlist?list=') lengths=$(cat "${1}" | grep '<p class="length">') rescount=0 reslinkscount=$(echo "${links}" | wc -l) @@ -143,7 +143,12 @@ process () { time=$(echo "${lengths}" | head -n $rescount | tail -n 1) [[ $time == *"LIVE"* ]] && time="LIVE" || time=$(echo $time | cut -d '>' -f 2 | cut -d '<' -f 1) title=$(echo "${links}" | head -n $rescount | tail -n 1) - [[ $title == *"/playlist?list="* ]] && ln=$(echo $title | cut -d : -f 1) && title=$(sed "$((ln+=7))q;d" "${1}" | cut -d '>' -f 2 | cut -d '<' -f 1) || title=$(echo "${title}" | cut -d '>' -f 3 | cut -d '<' -f 1) + ln=$(echo $title | cut -d : -f 1) + if [[ $title == *"/playlist?list="* ]]; then + title=$(sed "$((ln+=7))q;d" "${1}" | cut -d '>' -f 2 | cut -d '<' -f 1) + else + title=$(sed "$((ln+=11))q;d" "${1}" | cut -d '>' -f 2 | cut -d '<' -f 1) + fi link=$(echo "${links}" | head -n $rescount | tail -n 1 | cut -d '/' -f 2 | cut -d \" -f 1) [[ -n $title && -n $link && -n $time ]] && echo "${title}" >> $2 && echo "${link}" >> $2 && echo "${time}" >> $2 done