Created
October 25, 2023 05:34
-
-
Save Xnuvers007/4ade7964b3c22959ea89cde8e3bb3308 to your computer and use it in GitHub Desktop.
this is script for download tiktok from snaptik.app using python and nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var h = undefined | |
var u = undefined | |
var n = undefined | |
var t = undefined | |
var e = undefined | |
var r = undefined | |
process.argv.forEach(function (val, index, array) { | |
if(index === 2) h = val | |
if(index === 3) u = parseInt(val) | |
if(index === 4) n = val | |
if(index === 5) t = parseInt(val) | |
if(index === 6) e = parseInt(val) | |
if(index === 7) r = parseInt(val) | |
}); | |
function _0xe61c(d, e, f) { | |
var g = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/".split(""); | |
var h = g.slice(0, e); | |
var i = g.slice(0, f); | |
var j = d.split("").reverse().reduce(function (a, b, c) { | |
if (h.indexOf(b) !== -1) | |
return a += h.indexOf(b) * Math.pow(e, c); | |
}, 0); | |
var k = ""; | |
while (j > 0) { | |
k = i[j % f] + k; | |
j = (j - j % f) / f; | |
} | |
return k || "0"; | |
} | |
function eval(h, u, n, t, e, r) { | |
r = ""; | |
for (var i = 0, len = h.length; i < len; i++) { | |
var s = ""; | |
while (h[i] !== n[e]) { | |
s += h[i]; | |
i++; | |
} | |
for (var j = 0; j < n.length; j++) | |
s = s.replace(new RegExp(n[j], "g"), j); | |
r += String.fromCharCode(_0xe61c(s, e, 10) - t); | |
} | |
return decodeURIComponent(escape(r)); | |
} | |
console.log(eval(h, u, n, t, e, r)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, subprocess, re | |
from bs4 import BeautifulSoup | |
def getParameter(): | |
token = "" | |
r = requests.get("https://snaptik.app") | |
print("RESPONSE URL_SITE ", r.status_code) | |
soup = BeautifulSoup(r.text, "lxml") | |
for el_input in soup.find_all("input"): | |
if(el_input.get("name") == "token"): | |
token = el_input.get("value") | |
return token | |
def make_req_server(token, url_video): | |
headers = { | |
'authority': 'snaptik.app', | |
'accept': '*/*', | |
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7', | |
'dnt': '1', | |
'origin': 'https://snaptik.app', | |
'referer': 'https://snaptik.app/', | |
'sec-ch-ua': '"Opera";v="99", "Chromium";v="113", "Not-A.Brand";v="24"', | |
'sec-ch-ua-mobile': '?0', | |
'sec-ch-ua-platform': '"Windows"', | |
'sec-fetch-dest': 'empty', | |
'sec-fetch-mode': 'cors', | |
'sec-fetch-site': 'same-origin' | |
} | |
response = requests.get('https://snaptik.app/abc2.php', headers=headers, params = { | |
'url': url_video, | |
'token': token | |
}) | |
return response | |
def extract_variable(response): | |
list_var = re.findall(r'\(\".*?,.*?,.*?,.*?,.*?.*?\)', response.text) | |
res_input = [] | |
for e in (list_var[0].split(",")): | |
res_input.append(str(e).replace("(", "").replace(")", "").replace('"', "")) | |
return res_input | |
def call_decoder(result_list_variable): | |
output = subprocess.check_output([ | |
'node', 'decode.js', | |
str(result_list_variable[0]), str(result_list_variable[1]), str(result_list_variable[2]), str(result_list_variable[3]), str(result_list_variable[4]), str(result_list_variable[5]) | |
]) | |
# Get result from decoder | |
result = (output).decode("utf-8") | |
return result | |
def get_url_video(html_page): | |
soup_res = BeautifulSoup(html_page, "lxml") | |
url_download_video = "" | |
for a in soup_res.find_all("a"): | |
url = a.get("href") | |
url = str(url).replace('\\', "").replace('"', "") | |
if("snaptik" in url): | |
url_download_video = url | |
return url_download_video | |
# Main funtion | |
def main(url_video): | |
token = getParameter() | |
print("TOKEN => ", token) | |
response = make_req_server(token = token, url_video = url_video) | |
print("RESPONSE SERVER => ", response.status_code) | |
result_list_variable = extract_variable(response) | |
print("VARIABLE FIND => ", len(result_list_variable)) | |
html_response = call_decoder(result_list_variable) | |
dd_url_video = get_url_video(html_response) | |
print("VIDEO URL => ", dd_url_video) | |
r = requests.get(dd_url_video) | |
print("RESPONSE VIDEO => ", r.status_code) | |
main(input("URL => ")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment