Path: blob/main/old/v1/to update/mobile/mobile_script.py
621 views
#!/usr/local/bin/python1# -*- coding: utf-8 -*-23VIDEO = "7126536525008882949" #video id45import requests, time, random, bs4, sys, re, base64, urllib.parse678class Main:9def __init__(self):1011self.url = "https://zefoy.com/"12self.session = requests.session()1314def solve_captcha(self, sessid):15try:16# -- get captcha image --17response = self.session.get(18self.url + "a1ef290e2636bf553f39817628b6ca49.php",19headers={20"origin": "https://zefoy.com",21"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36",22"x-requested-with": "XMLHttpRequest",23"cookie": f"PHPSESSID={sessid}",24},25params={26"_CAPTCHA": "",27"t": f"{round(random.random(), 8)} {int(time.time())}",28},29)3031json_data = {32"requests": [{33"image": {34"content": str(base64.b64encode(response.content).decode())35},36"features": [{"type": "TEXT_DETECTION"}]37}]38}3940req = requests.post(41url = 'https://content-vision.googleapis.com/v1/images:annotate',42headers = {43'x-origin': 'https://explorer.apis.google.com',44},45params = {46'alt': 'json',47'key': 'AIzaSyAa8yy0GdcGPHdtD083HiGGx_S0vMPScDM',48},49json = json_data50)5152captcha_answer = req.json()['responses'][0]["textAnnotations"][0]["description"]5354if captcha_answer == "" or captcha_answer is None:55self.solve_captcha(sessid)5657captcha_answer = re.compile('[^a-zA-Z]').sub('', captcha_answer).lower()5859# submit response60_response = self.session.post(61self.url,62data={63"captcha_secure": captcha_answer,64"r75619cf53f5a5d7aa6af82edfec3bf0": "",65},66headers={67"cookie": f"PHPSESSID={sessid}",68"origin": "https://zefoy.com",69"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36",70"x-requested-with": "XMLHttpRequest",71},72)73alpha_key = re.findall('(?<=")[a-z0-9]{16}', _response.text)[0]74print(f"Solved captcha ! | {captcha_answer}")7576return alpha_key7778except Exception as e:79print(f"Error: {e}")80print("Captcha Invalid | Check access to Zefoy | xtekky.com may be down")81self.solve_captcha(sessid)8283def get_sessid(self):84sessid = self.session.get(85self.url,86headers={87"origin": "https://zefoy.com",88"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36",89"x-requested-with": "XMLHttpRequest",90},91).cookies.values()[0]92return sessid9394def decrypt(self, data):95return base64.b64decode(urllib.parse.unquote(data[::-1])).decode()9697def decrypt_timer(self, data):98# decrypted = base64.b64decode(urllib.parse.unquote(data[::-1])).decode()99if len(re.findall(" \d{3}", data)) != 0:100timer = re.findall(" \d{3}", data)[0]101else:102timer = data.split("= ")[1].split("\n")[0]103104return int(timer)105106def views_loop(self, sessid, alpha_key):107while True:108time.sleep(2)109110request = self.session.post(111self.url + "c2VuZC9mb2xsb3dlcnNfdGlrdG9V",112headers={113"cookie": f"PHPSESSID={sessid}",114"origin": "https://zefoy.com",115"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36",116"x-requested-with": "XMLHttpRequest",117},118data={alpha_key: f"https://www.tiktok.com/@onlp/video/{VIDEO}"},119)120decryped_answer = self.decrypt(request.text)121122if "This service is currently not working" in decryped_answer:123print("Views not available in the moment")124input()125sys.exit()126127elif "Server too busy" in decryped_answer:128print("Server busy ! (waiting 10s)")129time.sleep(10)130continue131132elif "function updatetimer()" in decryped_answer:133print("\r", end="")134timer = self.decrypt_timer(decryped_answer)135136print(f"Timer: {timer} (not animated)")137time.sleep(timer)138139print(f"Sending views ...")140continue141142soup = bs4.BeautifulSoup(decryped_answer, "html.parser")143try:144beta_key = soup.find("input", {"type": "text"}).get("name")145except:146input(decryped_answer)147sys.exit()148149time.sleep(1)150151start = time.time()152send_views = requests.post(153self.url + "c2VuZC9mb2xsb3dlcnNfdGlrdG9V",154headers={155"cookie": f"PHPSESSID={sessid}",156"origin": "https://zefoy.com",157"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36",158"x-requested-with": "XMLHttpRequest",159},160data={beta_key: VIDEO},161)162latency = round(time.time() - start, 2)163if latency > 3:164print(f"Sent views [id={VIDEO}]")165166decrypted_response = self.decrypt(send_views.text)167168if "Too many requests. Please slow down." in decrypted_response:169print("Ratelimited")170time.sleep(120)171continue172173timer = self.decrypt_timer(decrypted_response)174175print(f"Timer: {timer} (not animated")176time.sleep(timer)177178print(f"Sending views ...")179180def main(self):181sessid = self.get_sessid()182print(f"Sessid: {sessid}")183alpha_key: str = self.solve_captcha(sessid)184print("\n" + f"Alpha Key: {alpha_key.upper()}")185186self.views_loop(sessid, alpha_key)187188189if __name__ == "__main__":190Main().main()191192193