28 lines
458 B
Bash
28 lines
458 B
Bash
|
#!/usr/bin/env bash
|
||
|
set -e
|
||
|
|
||
|
URL=$1
|
||
|
HOOK=$2
|
||
|
|
||
|
# start server
|
||
|
forever start -o server.log server.js > /dev/null
|
||
|
sleep 1
|
||
|
|
||
|
while ! grep --quiet "TikTok Signature server started" server.log; do
|
||
|
sleep 1
|
||
|
done
|
||
|
|
||
|
# execute browser.js *URL*
|
||
|
SIGNATURE=$(node browser.js $URL)
|
||
|
|
||
|
# get response
|
||
|
DATA=$(python grab.py "$URL" "$SIGNATURE")
|
||
|
|
||
|
# send to webhook
|
||
|
if [ -z "$HOOK" ]; then
|
||
|
echo "$DATA"
|
||
|
else
|
||
|
curl -X POST \
|
||
|
-d "data=$DATA" \
|
||
|
"$HOOK"
|
||
|
fi
|