summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)"