tiktokautouploader 0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tiktokautouploader/___init__.py +3 -0
- tiktokautouploader/function.py +431 -0
- tiktokautouploader-0.1.dist-info/LICENSE.md +21 -0
- tiktokautouploader-0.1.dist-info/METADATA +24 -0
- tiktokautouploader-0.1.dist-info/RECORD +7 -0
- tiktokautouploader-0.1.dist-info/WHEEL +5 -0
- tiktokautouploader-0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,431 @@
|
|
1
|
+
from playwright.sync_api import sync_playwright
|
2
|
+
import json
|
3
|
+
import time
|
4
|
+
import inference
|
5
|
+
import requests
|
6
|
+
from PIL import Image
|
7
|
+
import sys
|
8
|
+
import warnings
|
9
|
+
from transformers import AutoModel, AutoTokenizer
|
10
|
+
import torch
|
11
|
+
from sklearn.metrics.pairwise import cosine_similarity
|
12
|
+
warnings.filterwarnings("ignore")
|
13
|
+
|
14
|
+
def get_embedding(sentence):
|
15
|
+
tokenizer = AutoTokenizer.from_pretrained('distilbert-base-uncased')
|
16
|
+
model = AutoModel.from_pretrained('distilbert-base-uncased')
|
17
|
+
inputs = tokenizer(sentence, return_tensors='pt')
|
18
|
+
outputs = model(**inputs)
|
19
|
+
return outputs.last_hidden_state.mean(dim=1).detach()
|
20
|
+
|
21
|
+
def get_object(question):
|
22
|
+
objects = ["boat","book","camera","chair","american football","guitar","hat","tree", "basketball", "purse", "pineapple", "car"]
|
23
|
+
object_embeddings = []
|
24
|
+
|
25
|
+
for obj in objects:
|
26
|
+
object_embeddings.append(get_embedding(obj))
|
27
|
+
|
28
|
+
question_embedding = get_embedding(question)
|
29
|
+
|
30
|
+
similarities = []
|
31
|
+
|
32
|
+
for obj in object_embeddings:
|
33
|
+
similarities.append(cosine_similarity(question_embedding, obj).item())
|
34
|
+
|
35
|
+
best_match_idx = torch.argmax(torch.tensor(similarities))
|
36
|
+
best_match = objects[best_match_idx]
|
37
|
+
|
38
|
+
return best_match
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
def get_image_src(page):
|
43
|
+
image_url = page.get_attribute("img#captcha-verify-image", "src")
|
44
|
+
return image_url
|
45
|
+
|
46
|
+
def download_image(image_url):
|
47
|
+
response = requests.get(image_url)
|
48
|
+
image_path = "captcha_image.jpg"
|
49
|
+
with open(image_path, "wb") as f:
|
50
|
+
f.write(response.content)
|
51
|
+
return image_path
|
52
|
+
|
53
|
+
|
54
|
+
def run_inference_on_image_tougher(image_path, object):
|
55
|
+
|
56
|
+
found_proper = False
|
57
|
+
|
58
|
+
model = inference.get_model("captcha-2-6ehbe/1")
|
59
|
+
results = model.infer(image=image_path)
|
60
|
+
|
61
|
+
class_names = []
|
62
|
+
bounding_boxes = []
|
63
|
+
for obj in results[0].predictions:
|
64
|
+
class_names.append(obj.class_name)
|
65
|
+
bounding_boxes.append({
|
66
|
+
"x": obj.x,
|
67
|
+
"y": obj.y,
|
68
|
+
"width": obj.width,
|
69
|
+
"height": obj.height
|
70
|
+
})
|
71
|
+
|
72
|
+
bounding_box = []
|
73
|
+
class_to_click = object
|
74
|
+
for i, classes in enumerate(class_names):
|
75
|
+
if classes == class_to_click:
|
76
|
+
bounding_box.append(bounding_boxes[i])
|
77
|
+
|
78
|
+
if len(bounding_box) == 2:
|
79
|
+
found_proper = True
|
80
|
+
|
81
|
+
return bounding_box, found_proper
|
82
|
+
|
83
|
+
def run_inference_on_image(image_path):
|
84
|
+
|
85
|
+
model = inference.get_model("tk-3nwi9/2")
|
86
|
+
results = model.infer(image=image_path)
|
87
|
+
|
88
|
+
class_names = []
|
89
|
+
bounding_boxes = []
|
90
|
+
for obj in results[0].predictions:
|
91
|
+
class_names.append(obj.class_name)
|
92
|
+
bounding_boxes.append({
|
93
|
+
"x": obj.x,
|
94
|
+
"y": obj.y,
|
95
|
+
"width": obj.width,
|
96
|
+
"height": obj.height
|
97
|
+
})
|
98
|
+
|
99
|
+
already_written = []
|
100
|
+
bounding_box = []
|
101
|
+
class_to_click = []
|
102
|
+
for i, classes in enumerate(class_names):
|
103
|
+
if classes in already_written:
|
104
|
+
class_to_click.append(classes)
|
105
|
+
bounding_box.append(bounding_boxes[i])
|
106
|
+
index = already_written.index(classes)
|
107
|
+
bounding_box.append(bounding_boxes[index])
|
108
|
+
|
109
|
+
already_written.append(classes)
|
110
|
+
|
111
|
+
|
112
|
+
return bounding_box, class_to_click
|
113
|
+
|
114
|
+
def convert_to_webpage_coordinates(bounding_boxes, image_x, image_y, image_height_web, image_width_web, image_height_real, image_width_real):
|
115
|
+
|
116
|
+
webpage_coordinates = []
|
117
|
+
for box in bounding_boxes:
|
118
|
+
x_box = box['x']
|
119
|
+
y_box = box['y']
|
120
|
+
rel_x = (x_box * image_width_web) / image_width_real
|
121
|
+
rel_y = (y_box * image_height_web) / image_height_real
|
122
|
+
x_cord = image_x + rel_x
|
123
|
+
y_cord = image_y + rel_y
|
124
|
+
|
125
|
+
print(f'BOX_X: {rel_x} : BOX_Y: {rel_y}')
|
126
|
+
|
127
|
+
webpage_coordinates.append((x_cord, y_cord))
|
128
|
+
|
129
|
+
return webpage_coordinates
|
130
|
+
|
131
|
+
def click_on_objects(page, object_coords):
|
132
|
+
for (x, y) in object_coords:
|
133
|
+
page.mouse.click(x, y)
|
134
|
+
time.sleep(0.5)
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
def UploadTK(video, description, hashtags, cookies_path, sound_name=None, sound_aud_vol='mix', schedule=None, day=None, copyrightcheck=False):
|
139
|
+
|
140
|
+
"""
|
141
|
+
UPLOADS VIDEO TO TIKTOK
|
142
|
+
------------------------------------------------------------------------------------------------------------------------------------------------c
|
143
|
+
video (str) -> path to video to upload
|
144
|
+
description (str) -> description for video
|
145
|
+
hashtags (str)(array) -> hashtags for video
|
146
|
+
cookies_path (str) -> path to tik tok cookies .json file
|
147
|
+
sound_name (str) -> name of tik tok sound to use for video
|
148
|
+
sound_aud_vol (str) -> volume of tik tok sound, 'main', 'mix' or 'background', check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
149
|
+
schedule (str) -> format HH:MM, your local time to upload video
|
150
|
+
day (int) -> day to schedule video for, check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
151
|
+
copyrightcheck (bool) -> include copyright check or not; CODE FAILS IF DONT PASS COPYRIGHT CHECK
|
152
|
+
--------------------------------------------------------------------------------------------------------------------------------------------
|
153
|
+
"""
|
154
|
+
|
155
|
+
retries = 0
|
156
|
+
class_found = None
|
157
|
+
|
158
|
+
try:
|
159
|
+
with open(cookies_path , 'r') as cookiefile:
|
160
|
+
cookies = json.load(cookiefile)
|
161
|
+
except:
|
162
|
+
sys.exit("ERROR: COOKIES FILE NOT FOUND, make sure to copy the path of the cookies.json file")
|
163
|
+
|
164
|
+
try:
|
165
|
+
for cookie in cookies:
|
166
|
+
if cookie.get('sameSite') not in ['Strict', 'Lax', 'None']:
|
167
|
+
cookie['sameSite'] = 'Lax'
|
168
|
+
except:
|
169
|
+
sys.exit("ERROR: CANT READ COOKIES FILE, make sure the data in cookies.json is correct and in a valid format")
|
170
|
+
|
171
|
+
|
172
|
+
with sync_playwright() as p:
|
173
|
+
browser = p.chromium.launch(headless=True)
|
174
|
+
context = browser.new_context()
|
175
|
+
context.add_cookies(cookies)
|
176
|
+
page = context.new_page()
|
177
|
+
url = 'https://www.tiktok.com/tiktokstudio/upload?from=upload&lang=en'
|
178
|
+
|
179
|
+
while retries < 2:
|
180
|
+
try:
|
181
|
+
page.goto(url, timeout=60000)
|
182
|
+
except:
|
183
|
+
retries +=1
|
184
|
+
time.sleep(5)
|
185
|
+
if retries == 2:
|
186
|
+
sys.exit("ERROR: TIK TOK PAGE FAILED TO LOAD, try again.")
|
187
|
+
else:
|
188
|
+
break
|
189
|
+
|
190
|
+
|
191
|
+
image = get_image_src(page)
|
192
|
+
if image:
|
193
|
+
solved = False
|
194
|
+
attempts = 0
|
195
|
+
while solved == False:
|
196
|
+
attempts += 1
|
197
|
+
question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
|
198
|
+
if 'Select two objects that are the same' in question:
|
199
|
+
while class_found == None:
|
200
|
+
page.click('span.secsdk_captcha_refresh--text')
|
201
|
+
time.sleep(0.5)
|
202
|
+
image = get_image_src(page)
|
203
|
+
img_path = download_image(image)
|
204
|
+
b_box, class_found = run_inference_on_image(image_path=img_path)
|
205
|
+
print(f'CLICKING ON {class_found}')
|
206
|
+
|
207
|
+
with Image.open(img_path) as img:
|
208
|
+
image_size = img.size
|
209
|
+
|
210
|
+
image = page.locator('#captcha-verify-image')
|
211
|
+
image.wait_for()
|
212
|
+
box = image.bounding_box()
|
213
|
+
image_x = box['x']
|
214
|
+
image_y = box['y']
|
215
|
+
image_height_web = box['height']
|
216
|
+
image_width_web = box['width']
|
217
|
+
image_width_real, image_height_real = image_size
|
218
|
+
|
219
|
+
webpage_coords = convert_to_webpage_coordinates(b_box, image_x, image_y, image_height_web, image_width_web, image_height_real, image_width_real)
|
220
|
+
click_on_objects(page, webpage_coords)
|
221
|
+
time.sleep(0.5)
|
222
|
+
page.click("div.verify-captcha-submit-button")
|
223
|
+
if attempts > 5:
|
224
|
+
sys.exit("FAILED TO SOLVE CAPTCHA")
|
225
|
+
try:
|
226
|
+
page.wait_for_selector('input[type="file"][accept="video/*"]', timeout=5000)
|
227
|
+
solved = True
|
228
|
+
except:
|
229
|
+
continue
|
230
|
+
else:
|
231
|
+
found_prop = False
|
232
|
+
while found_prop == False:
|
233
|
+
page.click('span.secsdk_captcha_refresh--text')
|
234
|
+
time.sleep(0.5)
|
235
|
+
object = get_object(question)
|
236
|
+
image = get_image_src(page)
|
237
|
+
img_path = download_image(image)
|
238
|
+
if object == 'american football':
|
239
|
+
object = 'football'
|
240
|
+
b_box, found_prop = run_inference_on_image_tougher(image_path=img_path, object=object)
|
241
|
+
|
242
|
+
with Image.open(img_path) as img:
|
243
|
+
image_size = img.size
|
244
|
+
|
245
|
+
image = page.locator('#captcha-verify-image')
|
246
|
+
image.wait_for()
|
247
|
+
box = image.bounding_box()
|
248
|
+
image_x = box['x']
|
249
|
+
image_y = box['y']
|
250
|
+
image_height_web = box['height']
|
251
|
+
image_width_web = box['width']
|
252
|
+
image_width_real, image_height_real = image_size
|
253
|
+
|
254
|
+
webpage_coords = convert_to_webpage_coordinates(b_box, image_x, image_y, image_height_web, image_width_web, image_height_real, image_width_real)
|
255
|
+
click_on_objects(page, webpage_coords)
|
256
|
+
time.sleep(0.5)
|
257
|
+
page.click("div.verify-captcha-submit-button")
|
258
|
+
if attempts > 5:
|
259
|
+
sys.exit("FAILED TO SOLVE CAPTCHA")
|
260
|
+
try:
|
261
|
+
page.wait_for_selector('input[type="file"][accept="video/*"]', timeout=5000)
|
262
|
+
solved = True
|
263
|
+
except:
|
264
|
+
continue
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
try:
|
269
|
+
page.wait_for_selector('input[type="file"][accept="video/*"]', timeout=30000)
|
270
|
+
page.set_input_files('input[type="file"][accept="video/*"]', f'{video}')
|
271
|
+
except:
|
272
|
+
sys.exit("ERROR: INPUT FILE FAILED TO UPLOAD. Possible Issues: Wifi too slow, file directory wrong, or check documentation to see if captcha is solvable")
|
273
|
+
|
274
|
+
page.wait_for_selector('div[data-contents="true"]')
|
275
|
+
page.click('div[data-contents="true"]')
|
276
|
+
time.sleep(0.5)
|
277
|
+
if description == None:
|
278
|
+
sys.exit("ERROR: PLEASE INCLUDE A DESCRIPTION")
|
279
|
+
|
280
|
+
for _ in range(len(video) + 2):
|
281
|
+
page.keyboard.press("Backspace")
|
282
|
+
page.keyboard.press("Delete")
|
283
|
+
|
284
|
+
time.sleep(0.5)
|
285
|
+
|
286
|
+
page.keyboard.type(description)
|
287
|
+
|
288
|
+
for _ in range(3):
|
289
|
+
page.keyboard.press("Enter")
|
290
|
+
|
291
|
+
if hashtags != None:
|
292
|
+
for hashtag in hashtags:
|
293
|
+
if hashtag[0] != '#':
|
294
|
+
hashtag = "#" + hashtag
|
295
|
+
|
296
|
+
page.keyboard.type(hashtag)
|
297
|
+
time.sleep(0.5)
|
298
|
+
try:
|
299
|
+
page.click(f'span.hash-tag-topic:has-text("{hashtag}")', timeout=1000)
|
300
|
+
except:
|
301
|
+
try:
|
302
|
+
page.click('span.hash-tag-topic', timeout=1000)
|
303
|
+
except:
|
304
|
+
page.keyboard.press("Backspace")
|
305
|
+
try:
|
306
|
+
page.click('span.hash-tag-topic', timeout=1000)
|
307
|
+
except:
|
308
|
+
print(f"Tik tok hashtag not working for {hashtag}, moving onto next")
|
309
|
+
for _ in range(len(hashtag) + 1):
|
310
|
+
page.keyboard.press("Backspace")
|
311
|
+
|
312
|
+
try:
|
313
|
+
page.wait_for_function("document.querySelector('.info-progress-num').textContent.trim() === '100%'", timeout=3000000)
|
314
|
+
except:
|
315
|
+
sys.exit("ERROR: TIK TOK TOOK TOO LONG TO UPLOAD YOUR FILE (>50min). try a lower file size or different wifi connection")
|
316
|
+
|
317
|
+
time.sleep(0.5)
|
318
|
+
|
319
|
+
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--secondary:has-text("Save draft")')
|
320
|
+
page.wait_for_selector("path[d='M37.37 4.85a4.01 4.01 0 0 0-.99-.79 3 3 0 0 0-2.72 0c-.45.23-.81.6-1 .79a9 9 0 0 1-.04.05l-19.3 19.3c-1.64 1.63-2.53 2.52-3.35 3.47a36 36 0 0 0-4.32 6.16c-.6 1.1-1.14 2.24-2.11 4.33l-.3.6c-.4.75-.84 1.61-.8 2.43a2.5 2.5 0 0 0 2.37 2.36c.82.05 1.68-.4 2.44-.79l.59-.3c2.09-.97 3.23-1.5 4.33-2.11a36 36 0 0 0 6.16-4.32c.95-.82 1.84-1.71 3.47-3.34l19.3-19.3.05-.06a3 3 0 0 0 .78-3.71c-.22-.45-.6-.81-.78-1l-.02-.02-.03-.03-3.67-3.67a8.7 8.7 0 0 1-.06-.05ZM16.2 26.97 35.02 8.15l2.83 2.83L19.03 29.8c-1.7 1.7-2.5 2.5-3.33 3.21a32 32 0 0 1-7.65 4.93 32 32 0 0 1 4.93-7.65c.73-.82 1.51-1.61 3.22-3.32Z']")
|
321
|
+
page.click("path[d='M37.37 4.85a4.01 4.01 0 0 0-.99-.79 3 3 0 0 0-2.72 0c-.45.23-.81.6-1 .79a9 9 0 0 1-.04.05l-19.3 19.3c-1.64 1.63-2.53 2.52-3.35 3.47a36 36 0 0 0-4.32 6.16c-.6 1.1-1.14 2.24-2.11 4.33l-.3.6c-.4.75-.84 1.61-.8 2.43a2.5 2.5 0 0 0 2.37 2.36c.82.05 1.68-.4 2.44-.79l.59-.3c2.09-.97 3.23-1.5 4.33-2.11a36 36 0 0 0 6.16-4.32c.95-.82 1.84-1.71 3.47-3.34l19.3-19.3.05-.06a3 3 0 0 0 .78-3.71c-.22-.45-.6-.81-.78-1l-.02-.02-.03-.03-3.67-3.67a8.7 8.7 0 0 1-.06-.05ZM16.2 26.97 35.02 8.15l2.83 2.83L19.03 29.8c-1.7 1.7-2.5 2.5-3.33 3.21a32 32 0 0 1-7.65 4.93 32 32 0 0 1 4.93-7.65c.73-.82 1.51-1.61 3.22-3.32Z']")
|
322
|
+
page.wait_for_selector('div[data-contents="true"]')
|
323
|
+
page.wait_for_function("document.querySelector('.info-progress-num').textContent.trim() === '100%'", timeout=3000000)
|
324
|
+
time.sleep(0.5)
|
325
|
+
|
326
|
+
if sound_name != None:
|
327
|
+
page.click("div.TUXButton-label:has-text('Edit video')")
|
328
|
+
page.wait_for_selector("input.search-bar-input")
|
329
|
+
page.fill(f"input.search-bar-input", f"{sound_name}")
|
330
|
+
time.sleep(0.5)
|
331
|
+
page.click("div.TUXButton-label:has-text('Search')")
|
332
|
+
page.wait_for_selector('div.music-card-container')
|
333
|
+
page.click("div.music-card-container")
|
334
|
+
time.sleep(0.5)
|
335
|
+
page.click("div.TUXButton-label:has-text('Use')")
|
336
|
+
time.sleep(0.5)
|
337
|
+
page.click('img[src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMSAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgNy41MDE2QzAgNi42NzMxNyAwLjY3MTU3MyA2LjAwMTYgMS41IDYuMDAxNkgzLjU3NzA5QzMuODY4MDUgNi4wMDE2IDQuMTQ0NTggNS44NzQ4OCA0LjMzNDU1IDUuNjU0NDlMOC43NDI1NSAwLjU0MDUyQzkuMzQ3OCAtMC4xNjE2NjggMTAuNSAwLjI2NjM3NCAxMC41IDEuMTkzNDFWMTguOTY3MkMxMC41IDE5Ljg3NDUgOS4zODg5NCAyMC4zMTI5IDguNzY5NDIgMTkuNjVMNC4zMzE3OSAxNC45MDIxQzQuMTQyNjkgMTQuNjk5OCAzLjg3ODE2IDE0LjU4NDkgMy42MDEyMiAxNC41ODQ5SDEuNUMwLjY3MTU3MyAxNC41ODQ5IDAgMTMuOTEzNCAwIDEzLjA4NDlWNy41MDE2Wk01Ljg0OTQ1IDYuOTYwMjdDNS4yNzk1NiA3LjYyMTQzIDQuNDQ5OTcgOC4wMDE2IDMuNTc3MDkgOC4wMDE2SDJWMTIuNTg0OUgzLjYwMTIyQzQuNDMyMDMgMTIuNTg0OSA1LjIyNTY0IDEyLjkyOTUgNS43OTI5NSAxMy41MzY0TDguNSAxNi40MzI4VjMuODg1MjJMNS44NDk0NSA2Ljk2MDI3WiIgZmlsbD0iIzE2MTgyMyIgZmlsbC1vcGFjaXR5PSIwLjYiLz4KPHBhdGggZD0iTTEzLjUxNSA3LjE5MTE5QzEzLjM0MjQgNi45NzU1OSAxMy4zMzk5IDYuNjYwNTYgMTMuNTM1MiA2LjQ2NTNMMTQuMjQyMyA1Ljc1ODE5QzE0LjQzNzYgNS41NjI5MyAxNC43NTU4IDUuNTYxNzUgMTQuOTM1NiA1Ljc3MTM2QzE2Ljk5NTkgOC4xNzM2MiAxNi45OTU5IDExLjgyOCAxNC45MzU2IDE0LjIzMDNDMTQuNzU1OCAxNC40Mzk5IDE0LjQzNzYgMTQuNDM4NyAxNC4yNDIzIDE0LjI0MzVMMTMuNTM1MiAxMy41MzY0QzEzLjMzOTkgMTMuMzQxMSAxMy4zNDI0IDEzLjAyNjEgMTMuNTE1IDEyLjgxMDVDMTQuODEzIDExLjE4ODUgMTQuODEzIDguODEzMTIgMTMuNTE1IDcuMTkxMTlaIiBmaWxsPSIjMTYxODIzIiBmaWxsLW9wYWNpdHk9IjAuNiIvPgo8cGF0aCBkPSJNMTYuNzE3MiAxNi43MTgzQzE2LjUyMTkgMTYuNTIzMSAxNi41MjMxIDE2LjIwNzQgMTYuNzA3MiAxNi4wMDE3QzE5LjcyNTcgMTIuNjMgMTkuNzI1NyA3LjM3MTY4IDE2LjcwNzIgNC4wMDAwMUMxNi41MjMxIDMuNzk0MjcgMTYuNTIxOSAzLjQ3ODU4IDE2LjcxNzIgMy4yODMzMkwxNy40MjQzIDIuNTc2MjFDMTcuNjE5NSAyLjM4MDk1IDE3LjkzNyAyLjM4MDIgMTguMTIzMyAyLjU4NDA4QzIxLjkwOTkgNi43MjkyNiAyMS45MDk5IDEzLjI3MjQgMTguMTIzMyAxNy40MTc2QzE3LjkzNyAxNy42MjE1IDE3LjYxOTUgMTcuNjIwNyAxNy40MjQzIDE3LjQyNTVMMTYuNzE3MiAxNi43MTgzWiIgZmlsbD0iIzE2MTgyMyIgZmlsbC1vcGFjaXR5PSIwLjYiLz4KPC9zdmc+Cg=="]')
|
338
|
+
time.sleep(0.5)
|
339
|
+
sliders = page.locator("input.scaleInput")
|
340
|
+
time.sleep(0.5)
|
341
|
+
|
342
|
+
if sound_aud_vol == 'background':
|
343
|
+
slider1 = sliders.nth(0)
|
344
|
+
bounding_box1 = slider1.bounding_box()
|
345
|
+
if bounding_box1:
|
346
|
+
x1 = bounding_box1["x"] + (bounding_box1["width"] * 0.95)
|
347
|
+
y1 = bounding_box1["y"] + bounding_box1["height"] / 2
|
348
|
+
page.mouse.click(x1, y1)
|
349
|
+
|
350
|
+
slider2 = sliders.nth(1)
|
351
|
+
bounding_box2 = slider2.bounding_box()
|
352
|
+
if bounding_box2:
|
353
|
+
x2 = bounding_box2["x"] + (bounding_box2["width"] * 0.097)
|
354
|
+
y2 = bounding_box2["y"] + bounding_box2["height"] / 2
|
355
|
+
page.mouse.click(x2, y2)
|
356
|
+
|
357
|
+
if sound_aud_vol == 'main':
|
358
|
+
slider1 = sliders.nth(0)
|
359
|
+
bounding_box1 = slider1.bounding_box()
|
360
|
+
if bounding_box1:
|
361
|
+
x1 = bounding_box1["x"] + (bounding_box1["width"] * 0.097)
|
362
|
+
y1 = bounding_box1["y"] + bounding_box1["height"] / 2
|
363
|
+
page.mouse.click(x1, y1)
|
364
|
+
slider2 = sliders.nth(1)
|
365
|
+
bounding_box2 = slider2.bounding_box()
|
366
|
+
if bounding_box2:
|
367
|
+
x2 = bounding_box2["x"] + (bounding_box2["width"] * 0.95)
|
368
|
+
y2 = bounding_box2["y"] + bounding_box2["height"] / 2
|
369
|
+
page.mouse.click(x2, y2)
|
370
|
+
|
371
|
+
|
372
|
+
time.sleep(0.5)
|
373
|
+
page.click("div.TUXButton-label:has-text('Save edit')")
|
374
|
+
|
375
|
+
page.wait_for_selector('div[data-contents="true"]')
|
376
|
+
if schedule != None:
|
377
|
+
try:
|
378
|
+
hour = schedule[0:2]
|
379
|
+
minute = schedule[3:]
|
380
|
+
print(hour, minute)
|
381
|
+
if (int(minute) % 5) != 0:
|
382
|
+
sys.exit("MINUTE FORMAT ERROR: PLEASE MAKE SURE MINUTE YOU SCHEDULE AT IS A MULTIPLE OF 5 UNTIL 60 (i.e: 40)")
|
383
|
+
|
384
|
+
except:
|
385
|
+
sys.exit("SCHEDULE TIME ERROR: PLEASE MAKE SURE YOUR SCHEDULE TIME IS A STRING THAT FOLLOWS THE 24H FORMAT 'HH:MM'")
|
386
|
+
|
387
|
+
page.locator('div.TUXRadioStandalone.TUXRadioStandalone--medium').nth(1).click()
|
388
|
+
time.sleep(0.5)
|
389
|
+
if day != None:
|
390
|
+
page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).click()
|
391
|
+
time.sleep(0.5)
|
392
|
+
try:
|
393
|
+
page.locator(f'span.day.valid:has-text("{day}")').click()
|
394
|
+
except:
|
395
|
+
sys.exit("SCHEDULE DAY ERROR: ERROR WITH SCHEDULED DAY, read documentation for more information on format of day")
|
396
|
+
try:
|
397
|
+
page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(0).click()
|
398
|
+
time.sleep(0.5)
|
399
|
+
page.locator(f'.tiktok-timepicker-option-text:has-text("{hour}")').nth(0).scroll_into_view_if_needed()
|
400
|
+
page.locator(f'.tiktok-timepicker-option-text:has-text("{hour}")').nth(0).click()
|
401
|
+
time.sleep(1)
|
402
|
+
page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(0).click()
|
403
|
+
time.sleep(0.5)
|
404
|
+
page.locator(f'.tiktok-timepicker-option-text:has-text("{minute}")').nth(1).scroll_into_view_if_needed()
|
405
|
+
time.sleep(0.5)
|
406
|
+
page.locator(f'.tiktok-timepicker-option-text:has-text("{minute}")').nth(1).click()
|
407
|
+
|
408
|
+
error_message_locator = page.locator('span', has_text="Schedule at least 15 minutes in advance")
|
409
|
+
if error_message_locator.is_visible():
|
410
|
+
sys.exit("SCHEDULE TIME ERROR: SCHEDULING TIME SHOULD BE MORE THAN 15 MINUTES FROM YOUR CURRENT TIME")
|
411
|
+
|
412
|
+
except:
|
413
|
+
sys.exit("SCHEDULING ERROR")
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
if copyrightcheck == True:
|
419
|
+
page.locator("input#\\:r1h\\: + div.TUXSwitch-handle").click()
|
420
|
+
while copyrightcheck == True:
|
421
|
+
time.sleep(3)
|
422
|
+
if page.locator("span", has_text="No issues detected.").is_visible():
|
423
|
+
break
|
424
|
+
if page.locator("span", has_text="Copyright issues detected.").is_visible():
|
425
|
+
sys.exit("COPYRIGHT CHECK FAILED: COPYRIGHT AUDIO DETECTED FROM TIKTOK")
|
426
|
+
|
427
|
+
|
428
|
+
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary')
|
429
|
+
time.sleep(2)
|
430
|
+
|
431
|
+
page.close()
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) [2024] [HAZIQ KHALID]
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: tiktokautouploader
|
3
|
+
Version: 0.1
|
4
|
+
Summary: Upload or schedules videos to tiktok with tiktok sounds and hashtags that work.
|
5
|
+
Home-page: https://github.com/haziq-exe/TikTokAutoUploader
|
6
|
+
Author: HAZIQ KHALID
|
7
|
+
Author-email: haziqmk123@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
14
|
+
Classifier: Operating System :: OS Independent
|
15
|
+
Requires-Python: >=3.6
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
License-File: LICENSE.md
|
18
|
+
Requires-Dist: playwright >=1.0.0
|
19
|
+
Requires-Dist: requests >=2.0.0
|
20
|
+
Requires-Dist: Pillow >=8.0.0
|
21
|
+
Requires-Dist: transformers >=4.0.0
|
22
|
+
Requires-Dist: torch >=1.0.0
|
23
|
+
Requires-Dist: scikit-learn >=0.24.0
|
24
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
tiktokautouploader/___init__.py,sha256=2L-CuafzOqBa3W9m22MLhPMd3Zq4M-X-xvvpxg9c2l0,54
|
2
|
+
tiktokautouploader/function.py,sha256=4IE3TalKgnYMHHytUTu538e8mLaFRVs6ICg01mOVe5g,20640
|
3
|
+
tiktokautouploader-0.1.dist-info/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
|
4
|
+
tiktokautouploader-0.1.dist-info/METADATA,sha256=NPDmRjWTL3ZzlkfIVl7ARlrYQzvgUo9vvfTH8lTcqQU,899
|
5
|
+
tiktokautouploader-0.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
|
6
|
+
tiktokautouploader-0.1.dist-info/top_level.txt,sha256=qWHpLVcaD7RWLk-Kbm7dQJozxGecC0ldwh6dEBexOu4,19
|
7
|
+
tiktokautouploader-0.1.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
tiktokautouploader
|