Init
This commit is contained in:
commit
dbd9bf3dd5
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
FROM node
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
|
||||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 \
|
||||
libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
|
||||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
|
||||
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget vim
|
||||
|
||||
RUN npm i puppeteer puppeteer-extra puppeteer-extra-plugin-stealth && \
|
||||
git clone https://github.com/carcabot/tiktok-signature.git /home/tiktok && \
|
||||
npm i -g forever
|
||||
|
||||
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
||||
python get-pip.py && \
|
||||
pip install requests
|
||||
|
||||
WORKDIR /home/tiktok
|
||||
|
||||
COPY ./entrypoint.sh ./entrypoint.sh
|
||||
COPY ./grab.py ./grab.py
|
||||
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
28
entrypoint.sh
Executable file
28
entrypoint.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/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
|
15
grab.py
Normal file
15
grab.py
Normal file
@ -0,0 +1,15 @@
|
||||
import requests
|
||||
import sys
|
||||
|
||||
signature = sys.argv[2]
|
||||
url = sys.argv[1] + "&_signature=" + signature
|
||||
referer = "https://www.tiktok.com/@ondymikula/video/6757762109670477061"
|
||||
|
||||
request = requests.get(url, headers={
|
||||
"method": "GET",
|
||||
"accept-encoding": "gzip, deflate, br",
|
||||
"Referer": referer,
|
||||
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
|
||||
})
|
||||
|
||||
print(request.json())
|
Loading…
Reference in New Issue
Block a user