forked from Wizz1337/TikTokMassBotting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
170 lines (147 loc) · 6.12 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import ssl
import time
import queue
import threading
from random import randint, choice
from urllib3.exceptions import InsecureRequestWarning
from urllib.parse import urlparse
from http import cookiejar
import requests
from pystyle import Colorate, Colors, Write, Add, Center
from Data.UserAgent import UserAgent
from Data.Lists import DeviceTypes, Platforms, Channel, ApiDomain
from utils import *
class BlockCookies(cookiejar.CookiePolicy):
return_ok = set_ok = domain_return_ok = path_return_ok = lambda self, *args, **kwargs: False
netscape = True
rfc2965 = hide_cookie2 = False
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
r = requests.Session()
countQueue = queue.Queue()
sentRequests = 0
completed = False
r.cookies.set_policy(BlockCookies())
def Banner():
clearConsole()
Banner1 = r"""
╔╦╗ ╦ ╦╔═ ╔═╗ ╦ ╦ ╔═╗ ╦═╗ ╔═╗
║ ║ ╠╩╗ ╚═╗ ╠═╣ ╠═╣ ╠╦╝ ║╣
╩ ╩ ╩ ╩ ╚═╝ ╩ ╩ ╩ ╩ ╩╚═ ╚═╝
discord.gg/devcenter
"""
Banner2 = r"""
, ,
/ \
((__-^^-,-^^-__))
`-_---' `---_-'
<__|o` 'o|__>
\ ` /
): :(
:o_o:
"-"
"""
print(Center.XCenter(Colorate.Vertical(Colors.yellow_to_red, Add.Add(Banner2, Banner1, center=True), 2)))
def sendView():
proxy = {f'{proxyType}': f'{proxyType}://{choice(proxyList)}'}
platform = choice(Platforms)
osVersion = randint(1, 12)
DeviceType = choice(DeviceTypes)
headers = {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"user-agent": choice(UserAgent)
}
appName = choice(["tiktok_web", "musically_go"])
Device_ID = randint(1000000000000000000, 9999999999999999999)
apiDomain = choice(ApiDomain)
channelLol = choice(Channel)
URI = f"https://{apiDomain}/aweme/v1/aweme/stats/?channel={channelLol}&device_type={DeviceType}&device_id={Device_ID}&os_version={osVersion}&version_code=220400&app_name={appName}&device_platform={platform}&aid=1988"
data = f"item_id={itemID}&play_delta=1"
try:
req = r.post(URI, headers=headers, data=data, proxies=proxy, timeout=5, verify=False)
return True
except:
return False
def sendShare():
platform = choice(Platforms)
osVersion = randint(1, 12)
DeviceType = choice(DeviceTypes)
headers = {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"user-agent": choice(UserAgent)
}
appName = choice(["tiktok_web", "musically_go"])
Device_ID = randint(1000000000000000000, 9999999999999999999)
apiDomain = choice(ApiDomain)
channelLol = choice(Channel)
URI = f"https://{apiDomain}/aweme/v1/aweme/stats/?channel={channelLol}&device_type={DeviceType}&device_id={Device_ID}&os_version={osVersion}&version_code=220400&app_name={appName}&device_platform={platform}&aid=1988"
data = f"item_id={itemID}&share_delta=1"
try:
req = r.post(URI, headers=headers, data=data, verify=False)
return True
except:
return False
def clearURL(link):
parsedURL = urlparse(link)
host = parsedURL.hostname.lower()
if "vm.tiktok.com" == host or "vt.tiktok.com" == host:
UrlParsed = urlparse(r.head(link, verify=False, allow_redirects=True, timeout=5).url)
return UrlParsed.path.split("/")[3]
else:
UrlParsed = urlparse(link)
return UrlParsed.path.split("/")[3]
def proccessThread(sendProccess):
while not completed:
if sendProccess():
countQueue.put(1)
def countThread():
global sentRequests, completed
while True:
countQueue.get()
sentRequests += 1
if amount > 0:
if sentRequests >= amount:
completed = True
def progressThread():
while True:
start = time.time()
startReq = sentRequests
time.sleep(1)
end = time.time()
endReq = sentRequests
elapsed = end - start
elapsedReq = endReq - startReq
print(f"{sentRequests} sent requests! {elapsedReq} requests/second.", end="\r")
if (__name__ == "__main__"):
clearConsole(); Banner()
VideoURI = str(Write.Input("Video Link > ", Colors.yellow_to_red, interval=0.0001))
amount = int(Write.Input("Amount (0=inf) > ", Colors.yellow_to_red, interval=0.0001))
nThreads = int(Write.Input("Thread Amount > ", Colors.yellow_to_red, interval=0.0001)); clearConsole(); Banner()
sendType = int(Write.Input("[0] - Views\n[1] - Shares > ", Colors.yellow_to_red, interval=0.0001)); clearConsole(); Banner()
itemID = clearURL(VideoURI)
proxyChoose = True
while proxyChoose:
proxyType = Write.Input("Select proxy type:\n[0] - http\n[1] - socks4\n[2] - socks5 > ", Colors.yellow_to_red, interval=0.0001)
if proxyType == "0":
proxyType = "http"
proxyChoose = False
elif proxyType == "1":
proxyType = "socks4"
proxyChoose = False
elif proxyType == "2":
proxyType = "socks5"
proxyChoose = False
proxyList = readProxiesFile()
clearConsole(); Banner()
print(Colorate.Horizontal(Colors.yellow_to_red, f"Hits are not counted"))
print(Colorate.Horizontal(Colors.yellow_to_red, f"Bot started! Check your video stats in 5 minutes !"))
if sendType == 0:
sendProcess = sendView
elif sendType == 1:
sendProcess = sendShare
else:
print(f"Error {sendType}")
threading.Thread(target=countThread).start()
threading.Thread(target=progressThread).start()
for n in range(nThreads):
threading.Thread(target=proccessThread, args=(sendProcess,)).start()