summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlucashemi <lucasxberger@gmail.com>2022-12-07 13:59:53 -0300
committerlucashemi <lucasxberger@gmail.com>2022-12-07 13:59:53 -0300
commitd194a2a76fd2bdf32f206d7a0177c6956cf33827 (patch)
treee2f6b0876d7cb9f4a1f6a7a71c37bf9e33bd35ce
parent5512eb5b4cdf0d78779fabf7f7a7a6513c9bfd08 (diff)
multiprogram support
-rw-r--r--README.md2
-rwxr-xr-xyts4
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)"