Untitled
unknown
python
3 years ago
12 kB
29
Indexable
import requests import undetected_chromedriver as uc from time import sleep import random from selenium.webdriver.common.by import By import os from selenium.webdriver import ActionChains from selenium.webdriver.common.keys import Keys import json import colorama import random colorama.init() with open('tokenttc.txt',mode='a+') as doc: doc.read() with open('id_tiktok.text',mode='a+') as doc: doc.read() with open('tokenttc.txt',mode='r') as doc: lay_token = doc.read() #===========================Token======================= if lay_token == "": your_token = str(input("token ttc : ")) with open("tokenttc.txt", mode="a+") as viet: viet.write(your_token+"\n") else: tokens = lay_token.split("\n") for i in range(len(tokens)-1): print(f"{i+1}" +"\033[1;36;31m * \033[39m" + tokens[i]) chon_token = str(input("Chọn token nếu không có ấn [n] : ")) down_text = chon_token.lower() if down_text == "n": your_token = str(input("token tds : ")) with open("tokenttc.txt", mode="a+") as viet: viet.write(your_token+"\n") else: your_token = tokens[int(chon_token)-1] #======================================Login========================== token = {"access_token": your_token} login = requests.post("https://tuongtaccheo.com/logintoken.php",data=token) cookies = login.cookies print(login.json()) #==========================================id_tik_tok==================== with open("id_tiktok.text",mode='r') as get_id_tiktok : get_file_tiktok = get_id_tiktok.read() get_file_tiktok = get_file_tiktok.split('\n') if get_file_tiktok[0] == '': id_tiktok = str(input("Nhập id tik tok : ")) with open("id_tiktok.text", mode='a+') as get_id_tiktok: get_file_tiktok = get_id_tiktok.write(id_tiktok+'\n') else: for i in range(len(get_file_tiktok)-1): print(f"{i+1}" +"\033[1;36;31m * \033[39m" + get_file_tiktok[i]) chon_id = str(input("Chọn id tiktok hiện có ở file nếu ko [n] : ")) if chon_id.lower() == 'n': id_tiktok = str(input("Nhập id tik tok : ")) with open("id_tiktok.text", mode='a+') as get_id_tiktok: get_file_tiktok = get_id_tiktok.write(id_tiktok + '\n') else: id_tiktok = get_file_tiktok[int(chon_id)-1] headers_tiktok = { 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36'} link_tiktok = 'https://www.tiktok.com/@'+id_tiktok get_id_mess = requests.get(url=link_tiktok,headers=headers_tiktok).text chia = '"'+id_tiktok+'":{"id":"' done_get_id_mess = get_id_mess.split(chia)[1].split('"')[0] print(done_get_id_mess) #=====================================Đặt nick======================== headers={ "accept" : "*/*", "Host" : "tuongtaccheo.com", "content-type":"application/x-www-form-urlencoded; charset=UTF-8", "referer" : "https://tuongtaccheo.com/cauhinh/tiktok.php", "x-requested-with":"XMLHttpRequest" } data = { "iddat[]":done_get_id_mess, "loai":"tt"} dat_nick = requests.post("https://tuongtaccheo.com/cauhinh/datnick.php",headers=headers,data=data,cookies=login.cookies) if int(dat_nick.text) == 1: print("Đặt nick thành công") else: print("False") print('''[1]: follow [2]: tim [3]: comment''') chon = int(input("Nhập số muốn chọn : ")) if chon == 1: muon_nhan = int(input("Bao lâu nhận job bạn nhỉ : ")) else: pass tu = int(input("Nhap do tre tu : ")) den = int(input("Den :")) #=================================================================== chon_cach_dn = int(input('''chọn đăng nhập profile ấn [1] chọn đăng nhập cookies ấn [0] : ''')) #======================Cookies==== if chon_cach_dn == 0: m = str(input("Nhap cookies : ")) sleep(2) os.system('cls') l = [] options=uc.ChromeOptions() options.add_argument('--mute-audio') options.add_argument('--user-agent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 AOL/11.0 AOLBUILD/11.0.1759 Safari/537.36') options.add_argument("user-data-dir=C:\\profile") driver = uc.Chrome(options=options) driver.set_window_size(500, 815) driver.get('https://www.tiktok.com/') achains = ActionChains(driver) sleep(3) for i in range(1): sessionid = m.split("sessionid=")[1].split(";")[0] msToken = m.split("msToken=")[1].split(";")[0] check = check = m.split(";") for i in range(len(check)): if "msToken" in check[i]: l.append(check[i]) msToken_2 = l[1].split("msToken=")[1].split(';')[0] tong1={"name":"sessionid","value":f"{sessionid}","domain":".tiktok.com"} tong2={"name":"msToken","value":f"{msToken}","domain":".www.tiktok.com"} tong3={"name":"msToken","value":f"{msToken_2}","domain":".tiktok.com"} driver.add_cookie(tong1) driver.add_cookie(tong2) driver.add_cookie(tong3) driver.get("https://tiktok.com/") else: with open("duong_dan.text", mode='a+') as read: lay_profile = read.read() with open("duong_dan.text", mode='r') as read: lay_profile = read.read() lay_profile = lay_profile.split('\n') if lay_profile[0] == '': chon_profile = str(input("nhập đường dẫn profile : ")) with open('duong_dan.text',mode = 'a+') as write: write.write(chon_profile+'\n') x = str(input("Profile số mấy nhỉ : ")) profile = "user-data-dir=" + chon_profile.split()[0] + f"\profile {x}" else: for i in range(len(lay_profile)-1): print(f"{i+1} \033[1;36;31m * \033[39m" + lay_profile[i]) chon_profile = str(input("Mời bạn chọn đường dẫn đã có nếu không [n] : ")) if chon_profile.lower() == 'n': chon_profile = str(input("nhập đường dẫn profile : ")) with open('duong_dan.text', mode='a+') as write: write.write(chon_profile + '\n') x = str(input("Profile số mấy nhỉ : ")) profile = "user-data-dir=" + chon_profile.split()[0] + f"\profile {x}" else: chon_profile = lay_profile[int(chon_profile)-1] x = str(input("Profile số mấy nhỉ : ")) profile = "user-data-dir="+chon_profile.split()[0]+f"\profile {x}" print(profile) #============================================================= CHỌN CHẾ ĐỘ sleep(2) os.system('cls') #=============================================================== MỞ CHROME options = uc.ChromeOptions() options.page_load_strategy = 'none' options.add_argument(profile) driver = uc.Chrome(options=options) driver.set_window_size(500, 815) driver.get('https://www.tiktok.com/') achains = ActionChains(driver) chua_dn = 0 dung = 1 while True: try: driver.find_element(By.CLASS_NAME, "tiktok-1igqi6u-DivProfileContainer.efubjyv0") print("Bạn đã đn rồi") break except: if chua_dn == 0: print("BẠn chưa đn tôi sẽ đợi bạn") chua_dn = 1 else: sleep(2) continue s = requests.session() s.headers.update({ "accept" : r"application/json, text/javascript, */*; q=0.01", "Host" : "tuongtaccheo.com", "referer":"https://tuongtaccheo.com/tiktok/kiemtien/", "x-requested-with":"XMLHttpRequest" }) print(dat_nick.json()) #LAY NHIEM VU sai = 0 data_gui = "" i = 0 list_black = [] Y = 0 dem_luot = 0 tranh_check = 0 while True: if dem_luot >= random.randint(15,20): Y = 0 dem_luot = 0 break else: Y = Y + random.randint(500,600) down = "window.scrollTo(0, "+str(Y)+")" driver.execute_script(down) sleep(random.uniform(5,7)) dem_luot = dem_luot + 1 if chon == 1: while True: get_job = s.get("https://tuongtaccheo.com/tiktok/kiemtien/subcheo/getpost.php",cookies=cookies) for dict in get_job.json(): if i == 0: a = str(dict['idpost']) else: a = "," + str(dict['idpost']) data_gui = data_gui + a name = dict['link'] link = "https://www.tiktok.com/@" +str(name) print(link) driver.get(link) sleep(random.uniform(tu,den)) # Kiểm thử try: check = driver.find_element(By.CLASS_NAME, "e143oaad5.tiktok-12hrm60-Button-StyledFollowButton.ehk74z00") check.click() sleep(2) except: pass # không có gì xảy ra kiem_tra = data_gui.split(",") if int(len(kiem_tra)) >= int(muon_nhan): sleep(1) nhan = s.post("https://tuongtaccheo.com/tiktok/kiemtien/subcheo/nhantien.php",cookies=cookies,data ={"id":data_gui}) print(nhan.json()) data_gui = "" i = 0 else: i = 1 sleep(5) elif chon == 2: while True: s = requests.session() s.headers.update({ "accept" : r"application/json, text/javascript, */*; q=0.01", "Host" : "tuongtaccheo.com", "referer":"https://tuongtaccheo.com/tiktok/kiemtien/", "x-requested-with":"XMLHttpRequest" }) get_job = s.get("https://tuongtaccheo.com/tiktok/kiemtien/getpost.php",cookies=cookies) for dict in get_job.json(): data_gui = str(dict['idpost']) link = dict['link'] driver.get(link) sleep(random.uniform(tu,den)) try: check_heart = driver.find_elements(By.CLASS_NAME, "tiktok-ouggfm-SpanIconWrapper.e1bs7gq21")[0].find_element(By.TAG_NAME, "svg").get_attribute("fill") except: check_heart = "none" if check_heart == "currentColor": try: move = driver.find_elements(By.CLASS_NAME, "tiktok-ouggfm-SpanIconWrapper.e1bs7gq21")[1] achains.move_to_element(move).perform() sleep(2) driver.find_elements(By.CLASS_NAME, "tiktok-ouggfm-SpanIconWrapper.e1bs7gq21")[0].click() except: pass sleep(2) #===========================Gửi nhiệm vụ nhan = s.post("https://tuongtaccheo.com/tiktok/kiemtien/nhantien.php",cookies=cookies,data ={"id":data_gui}) try: print(nhan.json()['mess']) while True: if dem_luot >= random.randint(3,5): Y = 0 dem_luot = 0 break else: Y = Y + random.randint(500,600) down = "window.scrollTo("+str(random.uniform(5,8))+", "+str(Y)+")" driver.execute_script(down) sleep(random.uniform(5,7)) dem_luot = dem_luot + 1 except: print(nhan.json()) sleep(1) print("==================================================") elif check_heart == "none": pass else: pass sleep(5) elif chon == 3: while True: get_job = s.get("https://tuongtaccheo.com/tiktok/kiemtien/cmtcheo/getpost.php",cookies=cookies) for dict in get_job.json(): data_gui = str(dict['idpost']) link = dict['link'] nd = json.loads(dict['nd']) chon_nd = nd[random.randint(0, len(nd)-1)] if link in list_black: pass else: driver.get(link) sleep(random.uniform(tu,den)) try: done = 1 driver.find_elements(By.CLASS_NAME, "tiktok-ouggfm-SpanIconWrapper.e1bs7gq21")[1].click() sleep(2) #code here driver.find_elements(By.CLASS_NAME, "tiktok-qpucp9-DivInputEditorContainer.ecav6zu3")[0].click() sleep(1) for character in chon_nd: achains.send_keys(character).perform() sleep(random.uniform(0.1, 0.3)) sleep(1) achains.send_keys(Keys.ENTER).perform() sleep(1) except: done = 0 pass sleep(15) #===========================Gửi nhiệm vụ h = { 'accept': '*/*', 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 'referer': 'https://tuongtaccheo.com/tiktok/kiemtien/cmtcheo/', 'x-requested-with': 'XMLHttpRequest' } g = { 'id' : data_gui } l = 0 if done == 0: done = 1 pass else: while True: if l >= 4: print(z.json()) break else: z = requests.post('https://tuongtaccheo.com/tiktok/kiemtien/cmtcheo/nhantien.php',cookies=cookies,headers=h,data =g) try: if 'Video này lỗi' in z.json()['error2']: list_black.append(link) break else: sleep(6) except: try: print(z.json()['mess']) break except: print(z.json()['error']) break l = l+1 sleep(10)
Editor is loading...