commit 8f61a806f43371328a0805e6d74432ea3a6790dc parent e46c23f80627e322524c87cec39653b291110188 Author: parazyd <parazyd@dyne.org> Date: Fri, 17 Mar 2017 22:46:27 +0100 format ys output Diffstat:
M | ys | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/ys b/ys @@ -17,14 +17,21 @@ search() { sstr=$1 fi - curl -s \ + json="$(curl -s \ -G "https://www.googleapis.com/youtube/v3/search" \ -d part="snippet" \ -d q=$sstr \ -d maxResults=$NRES \ -d key=$KEY | \ jq '[.items[] | {"title":.snippet.title, - "url": ["https://www.youtube.com/watch?v=" + .id.videoId] }]' - + "url": ["https://www.youtube.com/watch?v=" + .id.videoId] }]' -)" + + printf -- "---------------------------------------------\n" + for i in $(seq 0 $(( $NRES - 1)) ); do + printf "%s" "$json" | jq ".[${i}].title" + printf "%s" "$json" | jq ".[${i}].url[]" + printf -- "---------------------------------------------\n" + done } case $1 in