Add API script
This commit is contained in:
parent
43a84512e4
commit
959559298b
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "content-type: text/html"
|
||||
echo
|
||||
echo "<meta charset=\"UTF-8\"/>"
|
||||
|
||||
args=$(echo "$SP_TRACK" | awk -F? '{print $2}' | sed 's/%20/ /g')
|
||||
|
||||
#session_id=$(echo $RANDOM | md5sum | head -c 20; echo)
|
||||
log_file="/tmp/spotify-dl.log"
|
||||
|
||||
result=$(../spotify-dl.sh "$args" | tee $log_file 2>&1 | grep "/var/www/spotify-dl/" | grep -v "Format String:" | awk -F/ '{print $NF}' | rev | cut -c6- | rev | head -n1)
|
||||
track=$(echo "$result" | awk -F '.mp3' '{print $1}')
|
||||
|
||||
if [[ $track ]];then
|
||||
echo "<div class='container'>"
|
||||
echo "<br>"
|
||||
echo "<center><h1>$track</center></h1>"
|
||||
echo "<br><br><br><br><br><br>"
|
||||
echo "<center>"
|
||||
echo "
|
||||
<audio id=\"player\" controls>
|
||||
<source src=\"https://spotify-dl.p2p.legal/play/$result\">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
"
|
||||
echo "<br><br>"
|
||||
echo "<h3><a href=\"https://spotify-dl.p2p.legal/dl/$result\">DOWNLOAD</a></h3>"
|
||||
echo "<br><br>"
|
||||
echo "</center>"
|
||||
echo "</div>"
|
||||
else
|
||||
echo "<center>No result found</center>"
|
||||
# echo "<meta http-equiv = \"refresh\" content = \" 2 \"/>"
|
||||
fi
|
||||
|
||||
## redirection: echo "<meta http-equiv = \"refresh\" content = \" 0 ; url = https://spotify-dl.p2p.legal/play/$result\"/>"
|
||||
|
||||
echo "
|
||||
<style>
|
||||
html {
|
||||
background-color: #272727;
|
||||
color: #E6E6E6;
|
||||
}
|
||||
a {
|
||||
color: #E6E6E6;
|
||||
}
|
||||
|
||||
#player {
|
||||
min-width: 250px;
|
||||
width: 40%;
|
||||
}
|
||||
.container-dis {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-moz-transform: translateX(-50%) translateY(-50%);
|
||||
-webkit-transform: translateX(-50%) translateY(-50%);
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
}
|
||||
</style>
|
||||
"
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
args="$@"
|
||||
|
||||
wget "$(curl -s \"https://spotify-dl.p2p.legal/search?$args\" | grep 'https://spotify-dl.p2p.legal/dl' | awk -F '\"' '{print $2}')"
|
Loading…
Reference in New Issue