From d194a2a76fd2bdf32f206d7a0177c6956cf33827 Mon Sep 17 00:00:00 2001 From: lucashemi Date: Wed, 7 Dec 2022 13:59:53 -0300 Subject: multiprogram support --- README.md | 2 +- yts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7257574..4563aa7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ytsearch -ytsearch is a shell script that searches a query in youtube and displays the link and the title of the videos in dmenu, you can then select the video to open in your browser. +ytsearch is a shell script that searches a query in youtube and displays the link and the title of the videos in dmenu, you can then select the video to open in your browser. You can also change the browser to mpv instead or use yt-dlp to download the video. ## Requirements diff --git a/yts b/yts index 7864a80..6c6a3d3 100755 --- a/yts +++ b/yts @@ -1,7 +1,7 @@ #!/bin/sh query=$(printf "" | dmenu -p "Search: " | sed 's/\ /+/g' ) -videos=$(curl -sL "https://www.youtube.com/results?search_query=${query}" | sed 's/},{/\n/g' | sed -nE 'N;N; s@.*\"videoRenderer\":\{\"videoId\":\"(.{11})\".*\"title\":\{\"runs\":\[\{\"text\":\"(.{1,100})\"\}\],.*@www.youtube.com/watch?v=\1 | \2@p') +videos=$(curl -sL "https://www.youtube.com/results?search_query=${query}" | sed 's/},{/\n/g' | sed -nE 'N;N; s@.*\"videoRenderer\":\{\"videoId\":\"(.{11})\".*\"title\":\{\"runs\":\[\{\"text\":\"(.{1,100})\"\}\],.*@https://www.youtube.com/watch?v=\1 | \2@p') url=$(printf "%s" "${videos}" | dmenu -i -l 15) [ -z "${url}" ] && exit -${BROWSER} "$(printf "%s" "${url}" | grep -Po '^.{35}')" +${BROWSER} "$(printf "%s" "${url}" | cut -d' ' -f1)" -- cgit v1.2.3-18-g5258