From e7511af4020827b5fe6117d9c836d610ab5874db Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 3 Oct 2021 20:55:15 +0500 Subject: [PATCH] bruh --- fetch-lyrics.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 fetch-lyrics.sh diff --git a/fetch-lyrics.sh b/fetch-lyrics.sh new file mode 100644 index 0000000..6068c22 --- /dev/null +++ b/fetch-lyrics.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +QUERY=$(echo $1 | sed "s/ /+/g") + +SEARCH=$(curl -s https://www.syair.info/search?q=${QUERY} \ + | pup 'a.title json{}') + +HREF=$(echo $SEARCH \ + | jq '.[].href' \ + | head -n1 \ + | sed 's/"//g') +TEXT=$(echo $SEARCH \ + | jq '.[].text' \ + | head -n1 \ + | sed 's/"//g') + +SONGNAME=$(echo $TEXT | cut --complement -d '-' -f 1 | cut -f1 -d '.' | sed 's/ //') +ARTISTNAME=$(echo $TEXT| cut -f1 -d '-' | head -c -2) + +FETCH=$(curl -s https://www.syair.info/${HREF} \ + | tail -n +13 \ + | sed "s/
//g" \ + | cut --complement -d '>' -f 1 \ + | head -n -1 > "/sdcard/RetroMusic/lyrics/${SONGNAME} - ${ARTISTNAME}.lrc")