tiktokautouploader 3.5__py2.py3-none-any.whl → 3.14__py2.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/function.py +144 -222
- {tiktokautouploader-3.5.dist-info → tiktokautouploader-3.14.dist-info}/METADATA +5 -11
- tiktokautouploader-3.14.dist-info/RECORD +7 -0
- tiktokautouploader-3.5.dist-info/RECORD +0 -7
- {tiktokautouploader-3.5.dist-info → tiktokautouploader-3.14.dist-info}/WHEEL +0 -0
- {tiktokautouploader-3.5.dist-info → tiktokautouploader-3.14.dist-info}/licenses/LICENSE.md +0 -0
tiktokautouploader/function.py
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
from playwright.sync_api import sync_playwright
|
2
2
|
import json
|
3
3
|
import time
|
4
|
+
import inference
|
4
5
|
import subprocess
|
5
|
-
from inference_sdk import InferenceHTTPClient
|
6
6
|
import pkg_resources
|
7
7
|
import requests
|
8
8
|
from PIL import Image
|
9
9
|
import sys
|
10
|
+
import base64
|
10
11
|
import os
|
12
|
+
from dotenv import load_dotenv
|
11
13
|
import warnings
|
14
|
+
load_dotenv()
|
12
15
|
warnings.simplefilter("ignore")
|
13
16
|
|
14
17
|
|
@@ -132,6 +135,8 @@ def get_image_src(page):
|
|
132
135
|
image_url = page.get_attribute("img#captcha-verify-image", "src")
|
133
136
|
return image_url
|
134
137
|
|
138
|
+
os.getenv('ROBOFLOW_API_KEY')
|
139
|
+
|
135
140
|
def download_image(image_url):
|
136
141
|
response = requests.get(image_url)
|
137
142
|
image_path = "captcha_image.jpg"
|
@@ -141,25 +146,18 @@ def download_image(image_url):
|
|
141
146
|
|
142
147
|
def run_inference_on_image_tougher(image_path, object):
|
143
148
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
CLIENT = InferenceHTTPClient(
|
148
|
-
api_url="https://detect.roboflow.com",
|
149
|
-
api_key=f"{rk}"
|
150
|
-
)
|
151
|
-
|
152
|
-
results = CLIENT.infer(image_path, model_id="captcha-2-6ehbe/2")
|
149
|
+
model = inference.get_model("captcha-2-6ehbe/2")
|
150
|
+
results = model.infer(image=image_path)
|
153
151
|
|
154
152
|
class_names = []
|
155
153
|
bounding_boxes = []
|
156
|
-
for obj in results[
|
157
|
-
class_names.append(obj
|
154
|
+
for obj in results[0].predictions:
|
155
|
+
class_names.append(obj.class_name)
|
158
156
|
bounding_boxes.append({
|
159
|
-
"x": obj
|
160
|
-
"y": obj
|
161
|
-
"width": obj
|
162
|
-
"height": obj
|
157
|
+
"x": obj.x,
|
158
|
+
"y": obj.y,
|
159
|
+
"width": obj.width,
|
160
|
+
"height": obj.height
|
163
161
|
})
|
164
162
|
|
165
163
|
bounding_box = []
|
@@ -174,40 +172,34 @@ def run_inference_on_image_tougher(image_path, object):
|
|
174
172
|
|
175
173
|
def run_inference_on_image(image_path):
|
176
174
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
CLIENT = InferenceHTTPClient(
|
181
|
-
api_url="https://detect.roboflow.com",
|
182
|
-
api_key=f"{rk}"
|
183
|
-
)
|
184
|
-
|
185
|
-
results = CLIENT.infer(image_path, model_id="tk-3nwi9/2")
|
175
|
+
model = inference.get_model("tk-3nwi9/2")
|
176
|
+
results = model.infer(image=image_path)
|
186
177
|
|
187
178
|
class_names = []
|
188
179
|
bounding_boxes = []
|
189
|
-
for obj in results[
|
190
|
-
class_names.append(obj
|
180
|
+
for obj in results[0].predictions:
|
181
|
+
class_names.append(obj.class_name)
|
191
182
|
bounding_boxes.append({
|
192
|
-
"x": obj
|
193
|
-
"y": obj
|
194
|
-
"width": obj
|
195
|
-
"height": obj
|
183
|
+
"x": obj.x,
|
184
|
+
"y": obj.y,
|
185
|
+
"width": obj.width,
|
186
|
+
"height": obj.height
|
196
187
|
})
|
197
188
|
|
198
189
|
already_written = []
|
199
190
|
bounding_box = []
|
200
191
|
class_to_click = []
|
201
|
-
for i,
|
202
|
-
if
|
203
|
-
class_to_click.append(
|
192
|
+
for i, classes in enumerate(class_names):
|
193
|
+
if classes in already_written:
|
194
|
+
class_to_click.append(classes)
|
204
195
|
bounding_box.append(bounding_boxes[i])
|
205
|
-
index = already_written.index(
|
196
|
+
index = already_written.index(classes)
|
206
197
|
bounding_box.append(bounding_boxes[index])
|
207
198
|
|
208
|
-
already_written.append(
|
199
|
+
already_written.append(classes)
|
209
200
|
|
210
201
|
found = False
|
202
|
+
|
211
203
|
if len(class_to_click) == 1:
|
212
204
|
found = True
|
213
205
|
|
@@ -235,14 +227,13 @@ def click_on_objects(page, object_coords):
|
|
235
227
|
|
236
228
|
|
237
229
|
|
238
|
-
def upload_tiktok(video, description, accountname, hashtags=None, sound_name=None, sound_aud_vol='mix', schedule=None, day=None, copyrightcheck=False, suppressprint=False
|
230
|
+
def upload_tiktok(video, description, accountname, hashtags=None, sound_name=None, sound_aud_vol='mix', schedule=None, day=None, copyrightcheck=False, suppressprint=False):
|
239
231
|
|
240
232
|
"""
|
241
233
|
UPLOADS VIDEO TO TIKTOK
|
242
234
|
------------------------------------------------------------------------------------------------------------------------------------------------c
|
243
235
|
video (str) -> path to video to upload
|
244
236
|
description (str) -> description for video
|
245
|
-
accountname (str) -> account to upload on
|
246
237
|
hashtags (str)(array) -> hashtags for video
|
247
238
|
sound_name (str) -> name of tik tok sound to use for video
|
248
239
|
sound_aud_vol (str) -> volume of tik tok sound, 'main', 'mix' or 'background', check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
@@ -250,7 +241,6 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
250
241
|
day (int) -> day to schedule video for, check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
251
242
|
copyrightcheck (bool) -> include copyright check or not; CODE FAILS IF FAIL COPYRIGHT CHECK
|
252
243
|
suppressprint (bool) -> True means function doesnt print anything to provide updates on progress
|
253
|
-
headless (bool) -> run in headless mode or not
|
254
244
|
--------------------------------------------------------------------------------------------------------------------------------------------
|
255
245
|
"""
|
256
246
|
try:
|
@@ -286,7 +276,8 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
286
276
|
|
287
277
|
with sync_playwright() as p:
|
288
278
|
|
289
|
-
browser = p.firefox.launch(headless=
|
279
|
+
browser = p.firefox.launch(headless=True)
|
280
|
+
|
290
281
|
context = browser.new_context()
|
291
282
|
context.add_cookies(cookies)
|
292
283
|
page = context.new_page()
|
@@ -472,16 +463,13 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
472
463
|
print("Description and Hashtags added")
|
473
464
|
|
474
465
|
try:
|
475
|
-
page.
|
466
|
+
page.wait_for_function("document.querySelector('.info-progress-num').textContent.trim() === '100%'", timeout=12000000)
|
476
467
|
except:
|
477
468
|
sys.exit("ERROR: TIK TOK TOOK TOO LONG TO UPLOAD YOUR FILE (>20min). Try again, if issue persists then try a lower file size or different wifi connection")
|
478
469
|
|
479
470
|
time.sleep(0.2)
|
480
471
|
if suppressprint == False:
|
481
472
|
print("Tik tok done loading file onto servers")
|
482
|
-
|
483
|
-
if (schedule == None) and (day != None):
|
484
|
-
sys.exit("ERROR: CANT SCHEDULE FOR ANOTHER DAY USING 'day' WITHOUT ALSO INCLUDING TIME OF UPLOAD WITH 'schedule'; PLEASE ALSO INCLUDE TIME WITH 'schedule' PARAMETER")
|
485
473
|
|
486
474
|
if schedule != None:
|
487
475
|
try:
|
@@ -493,39 +481,31 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
493
481
|
except:
|
494
482
|
sys.exit("SCHEDULE TIME ERROR: PLEASE MAKE SURE YOUR SCHEDULE TIME IS A STRING THAT FOLLOWS THE 24H FORMAT 'HH:MM', VIDEO SAVED AS DRAFT")
|
495
483
|
|
496
|
-
page.locator('div.TUXRadioStandalone.TUXRadioStandalone--medium
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
time.sleep(0.
|
504
|
-
else:
|
505
|
-
if page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).is_visible():
|
506
|
-
visible = True
|
507
|
-
time.sleep(0.1)
|
484
|
+
page.locator('div.TUXRadioStandalone.TUXRadioStandalone--medium').nth(1).click()
|
485
|
+
time.sleep(1)
|
486
|
+
if page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).is_visible():
|
487
|
+
page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).click()
|
488
|
+
time.sleep(0.2)
|
489
|
+
else:
|
490
|
+
if page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).is_visible():
|
491
|
+
time.sleep(0.2)
|
508
492
|
if day != None:
|
509
|
-
page.locator('div.TUXTextInputCore-
|
493
|
+
page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).click()
|
510
494
|
time.sleep(0.2)
|
511
495
|
try:
|
512
|
-
page.locator(f'span.day.valid:text
|
496
|
+
page.locator(f'span.day.valid:has-text("{day}")').click()
|
513
497
|
except:
|
514
498
|
sys.exit("SCHEDULE DAY ERROR: ERROR WITH SCHEDULED DAY, read documentation for more information on format of day")
|
515
499
|
try:
|
500
|
+
time.sleep(1)
|
501
|
+
page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(0).click()
|
516
502
|
time.sleep(0.2)
|
517
|
-
page.locator('
|
518
|
-
time.sleep(0.2)
|
519
|
-
page.locator(f'.tiktok-timepicker-option-text.tiktok-timepicker-right:text-is("{minute}")').scroll_into_view_if_needed()
|
503
|
+
page.locator(f'.tiktok-timepicker-option-text.tiktok-timepicker-right:has-text("{minute}")').nth(0).scroll_into_view_if_needed()
|
520
504
|
time.sleep(0.2)
|
521
|
-
page.locator(f'.tiktok-timepicker-option-text.tiktok-timepicker-right:text
|
505
|
+
page.locator(f'.tiktok-timepicker-option-text.tiktok-timepicker-right:has-text("{minute}")').nth(0).click()
|
522
506
|
time.sleep(0.2)
|
523
|
-
|
524
|
-
|
525
|
-
else:
|
526
|
-
page.locator('div.TUXTextInputCore-leadingIconWrapper:has(svg > path[d="M24 2a22 22 0 1 0 0 44 22 22 0 0 0 0-44ZM6 24a18 18 0 1 1 36 0 18 18 0 0 1-36 0Z"])').click()
|
527
|
-
page.locator(f'.tiktok-timepicker-option-text.tiktok-timepicker-left:text-is("{hour}")').scroll_into_view_if_needed()
|
528
|
-
page.locator(f'.tiktok-timepicker-option-text.tiktok-timepicker-left:text-is("{hour}")').click()
|
507
|
+
page.locator(f'.tiktok-timepicker-option-text:has-text("{hour}")').nth(0).scroll_into_view_if_needed()
|
508
|
+
page.locator(f'.tiktok-timepicker-option-text:has-text("{hour}")').nth(0).click()
|
529
509
|
time.sleep(1)
|
530
510
|
|
531
511
|
if suppressprint == False:
|
@@ -533,14 +513,93 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
533
513
|
|
534
514
|
except:
|
535
515
|
sys.exit("SCHEDULING ERROR: VIDEO SAVED AS DRAFT")
|
516
|
+
|
517
|
+
if (schedule == None) and (day != None):
|
518
|
+
sys.exit("ERROR: CANT SCHEDULE FOR ANOTHER DAY USING 'day' WITHOUT ALSO INCLUDING TIME OF UPLOAD WITH 'schedule'; PLEASE ALSO INCLUDE TIME WITH 'schedule' PARAMETER")
|
536
519
|
|
537
|
-
|
538
|
-
|
520
|
+
if(sound_name == None):
|
521
|
+
if copyrightcheck == True:
|
522
|
+
page.locator(".TUXSwitch-input").nth(0).click()
|
523
|
+
while copyrightcheck == True:
|
524
|
+
time.sleep(0.2)
|
525
|
+
if page.locator("span", has_text="No issues detected.").is_visible():
|
526
|
+
if suppressprint == False:
|
527
|
+
print("Copyright check complete")
|
528
|
+
break
|
529
|
+
if page.locator("span", has_text="Copyright issues detected.").is_visible():
|
530
|
+
sys.exit("COPYRIGHT CHECK FAILED: COPYRIGHT AUDIO DETECTED FROM TIKTOK")
|
531
|
+
|
532
|
+
if schedule == None:
|
533
|
+
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Post")', timeout=10000)
|
534
|
+
uploaded = False
|
535
|
+
checks = 0
|
536
|
+
while uploaded == False:
|
537
|
+
if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
|
538
|
+
time.sleep(0.2)
|
539
|
+
break
|
540
|
+
time.sleep(0.2)
|
541
|
+
checks += 1
|
542
|
+
if checks > 100:
|
543
|
+
time.sleep(10)
|
544
|
+
if checks == 150:
|
545
|
+
break
|
546
|
+
else:
|
547
|
+
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Schedule")', timeout=10000)
|
548
|
+
uploaded = False
|
549
|
+
checks = 0
|
550
|
+
while uploaded == False:
|
551
|
+
if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
|
552
|
+
time.sleep(0.2)
|
553
|
+
break
|
554
|
+
time.sleep(0.2)
|
555
|
+
checks += 1
|
556
|
+
if checks > 100:
|
557
|
+
time.sleep(10)
|
558
|
+
if checks == 150:
|
559
|
+
break
|
560
|
+
if suppressprint == False:
|
561
|
+
print("Done uploading video, NOTE: it may take a minute or two to show on TikTok")
|
562
|
+
|
563
|
+
page.close()
|
564
|
+
|
565
|
+
else:
|
539
566
|
try:
|
540
|
-
page.click(
|
567
|
+
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--secondary:has-text("Save draft")', timeout=10000)
|
568
|
+
except:
|
569
|
+
sys.exit("SAVE AS DRAFT BUTTON NOT FOUND; CANNOT ADD SOUND WITHOUT ABILITY TO SAVE DRAFTS")
|
570
|
+
|
571
|
+
time.sleep(0.5)
|
572
|
+
page.close()
|
573
|
+
|
574
|
+
browser = p.chromium.launch(headless=True)
|
575
|
+
|
576
|
+
context = browser.new_context()
|
577
|
+
context.add_cookies(cookies)
|
578
|
+
page = context.new_page()
|
579
|
+
url2 = 'https://www.tiktok.com/tiktokstudio/content?tab=draft'
|
580
|
+
|
581
|
+
while retries < 2:
|
582
|
+
try:
|
583
|
+
page.goto(url2, timeout=30000)
|
584
|
+
except:
|
585
|
+
retries +=1
|
586
|
+
time.sleep(5)
|
587
|
+
if retries == 2:
|
588
|
+
sys.exit("ERROR: TIK TOK PAGE FAILED TO LOAD, try again.")
|
589
|
+
else:
|
590
|
+
break
|
591
|
+
|
592
|
+
try:
|
593
|
+
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']")
|
594
|
+
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']")
|
595
|
+
page.wait_for_selector('div[data-contents="true"]')
|
596
|
+
page.wait_for_function("document.querySelector('.info-progress-num').textContent.trim() === '100%'", timeout=3000000)
|
597
|
+
time.sleep(0.2)
|
541
598
|
except:
|
542
|
-
|
543
|
-
|
599
|
+
sys.exit("ERROR ADDING SOUND: Video saved as draft")
|
600
|
+
|
601
|
+
if sound_name != None:
|
602
|
+
page.click("div.TUXButton-label:has-text('Edit video')")
|
544
603
|
page.wait_for_selector("input.search-bar-input")
|
545
604
|
page.fill(f"input.search-bar-input", f"{sound_name}")
|
546
605
|
time.sleep(0.2)
|
@@ -593,150 +652,11 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
593
652
|
page.click("div.TUXButton-label:has-text('Save edit')")
|
594
653
|
if suppressprint == False:
|
595
654
|
print("Added sound")
|
596
|
-
|
597
|
-
if sound_fail == False:
|
655
|
+
|
598
656
|
page.wait_for_selector('div[data-contents="true"]')
|
599
657
|
|
600
658
|
if copyrightcheck == True:
|
601
|
-
page.
|
602
|
-
while copyrightcheck == True:
|
603
|
-
time.sleep(0.2)
|
604
|
-
if page.locator("span", has_text="No issues detected.").is_visible():
|
605
|
-
if suppressprint == False:
|
606
|
-
print("Copyright check complete")
|
607
|
-
break
|
608
|
-
if page.locator("span", has_text="Copyright issues detected.").is_visible():
|
609
|
-
sys.exit("COPYRIGHT CHECK FAILED: VIDEO SAVED AS DRAFT, COPYRIGHT AUDIO DETECTED FROM TIKTOK")
|
610
|
-
|
611
|
-
|
612
|
-
try:
|
613
|
-
if schedule == None:
|
614
|
-
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Post")', timeout=10000)
|
615
|
-
uploaded = False
|
616
|
-
checks = 0
|
617
|
-
while uploaded == False:
|
618
|
-
if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
|
619
|
-
time.sleep(0.1)
|
620
|
-
break
|
621
|
-
time.sleep(0.2)
|
622
|
-
checks += 1
|
623
|
-
if checks == 25:
|
624
|
-
break
|
625
|
-
else:
|
626
|
-
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Schedule")', timeout=10000)
|
627
|
-
uploaded = False
|
628
|
-
checks = 0
|
629
|
-
while uploaded == False:
|
630
|
-
if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
|
631
|
-
time.sleep(0.2)
|
632
|
-
break
|
633
|
-
time.sleep(0.2)
|
634
|
-
checks += 1
|
635
|
-
if checks == 25:
|
636
|
-
break
|
637
|
-
if suppressprint == False:
|
638
|
-
print("Done uploading video, NOTE: it may take a minute or two to show on TikTok")
|
639
|
-
except:
|
640
|
-
time.sleep(2)
|
641
|
-
sys.exit("POSSIBLE ERROR UPLOADING: Cannot confirm if uploaded successfully, Please check account in a minute or two to confirm.")
|
642
|
-
time.sleep(1)
|
643
|
-
|
644
|
-
page.close()
|
645
|
-
else:
|
646
|
-
try:
|
647
|
-
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--secondary:has-text("Save draft")', timeout=10000)
|
648
|
-
except:
|
649
|
-
sys.exit("SAVE AS DRAFT BUTTON NOT FOUND; Please try account that has ability to save as draft")
|
650
|
-
|
651
|
-
time.sleep(0.5)
|
652
|
-
page.close()
|
653
|
-
|
654
|
-
browser = p.chromium.launch(headless=headless)
|
655
|
-
|
656
|
-
context = browser.new_context()
|
657
|
-
context.add_cookies(cookies)
|
658
|
-
page = context.new_page()
|
659
|
-
url2 = 'https://www.tiktok.com/tiktokstudio/content?tab=draft'
|
660
|
-
|
661
|
-
while retries < 2:
|
662
|
-
try:
|
663
|
-
page.goto(url2, timeout=30000)
|
664
|
-
except:
|
665
|
-
retries +=1
|
666
|
-
time.sleep(5)
|
667
|
-
if retries == 2:
|
668
|
-
sys.exit("ERROR: TIK TOK PAGE FAILED TO LOAD, try again.")
|
669
|
-
else:
|
670
|
-
break
|
671
|
-
|
672
|
-
try:
|
673
|
-
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']")
|
674
|
-
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']")
|
675
|
-
page.wait_for_selector('div[data-contents="true"]')
|
676
|
-
time.sleep(0.2)
|
677
|
-
except:
|
678
|
-
sys.exit("ERROR ADDING SOUND: Video saved as draft")
|
679
|
-
|
680
|
-
if sound_name != None:
|
681
|
-
page.click("div.TUXButton-label:has-text('Edit video')")
|
682
|
-
page.wait_for_selector("input.search-bar-input")
|
683
|
-
page.fill(f"input.search-bar-input", f"{sound_name}")
|
684
|
-
time.sleep(0.2)
|
685
|
-
page.click("div.TUXButton-label:has-text('Search')")
|
686
|
-
try:
|
687
|
-
page.wait_for_selector('div.music-card-container')
|
688
|
-
page.click("div.music-card-container")
|
689
|
-
page.wait_for_selector("div.TUXButton-label:has-text('Use')")
|
690
|
-
page.click("div.TUXButton-label:has-text('Use')")
|
691
|
-
except:
|
692
|
-
sys.exit(f"ERROR: SOUND '{sound_name}' NOT FOUND")
|
693
|
-
try:
|
694
|
-
page.wait_for_selector('img[src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMSAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgNy41MDE2QzAgNi42NzMxNyAwLjY3MTU3MyA2LjAwMTYgMS41IDYuMDAxNkgzLjU3NzA5QzMuODY4MDUgNi4wMDE2IDQuMTQ0NTggNS44NzQ4OCA0LjMzNDU1IDUuNjU0NDlMOC43NDI1NSAwLjU0MDUyQzkuMzQ3OCAtMC4xNjE2NjggMTAuNSAwLjI2NjM3NCAxMC41IDEuMTkzNDFWMTguOTY3MkMxMC41IDE5Ljg3NDUgOS4zODg5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jM4MDIgMTguMTIzMyAyLjU4NDA4QzIxLjkwOTkgNi43MjkyNiAyMS45MDk5IDEzLjI3MjQgMTguMTIzMyAxNy40MTc2QzE3LjkzNyAxNy42MjE1IDE3LjYxOTUgMTcuNjIwNyAxNy40MjQzIDE3LjQyNTVMMTYuNzE3MiAxNi43MTgzWiIgZmlsbD0iIzE2MTgyMyIgZmlsbC1vcGFjaXR5PSIwLjYiLz4KPC9zdmc+Cg=="]')
|
696
|
-
time.sleep(0.5)
|
697
|
-
sliders = page.locator("input.scaleInput")
|
698
|
-
|
699
|
-
if sound_aud_vol == 'background':
|
700
|
-
slider1 = sliders.nth(0)
|
701
|
-
bounding_box1 = slider1.bounding_box()
|
702
|
-
if bounding_box1:
|
703
|
-
x1 = bounding_box1["x"] + (bounding_box1["width"] * 0.92)
|
704
|
-
y1 = bounding_box1["y"] + bounding_box1["height"] / 2
|
705
|
-
page.mouse.click(x1, y1)
|
706
|
-
|
707
|
-
slider2 = sliders.nth(1)
|
708
|
-
bounding_box2 = slider2.bounding_box()
|
709
|
-
if bounding_box2:
|
710
|
-
x2 = bounding_box2["x"] + (bounding_box2["width"] * 0.097)
|
711
|
-
y2 = bounding_box2["y"] + bounding_box2["height"] / 2
|
712
|
-
page.mouse.click(x2, y2)
|
713
|
-
|
714
|
-
if sound_aud_vol == 'main':
|
715
|
-
slider1 = sliders.nth(0)
|
716
|
-
bounding_box1 = slider1.bounding_box()
|
717
|
-
if bounding_box1:
|
718
|
-
x1 = bounding_box1["x"] + (bounding_box1["width"] * 0.092)
|
719
|
-
y1 = bounding_box1["y"] + bounding_box1["height"] / 2
|
720
|
-
page.mouse.click(x1, y1)
|
721
|
-
slider2 = sliders.nth(1)
|
722
|
-
bounding_box2 = slider2.bounding_box()
|
723
|
-
if bounding_box2:
|
724
|
-
x2 = bounding_box2["x"] + (bounding_box2["width"] * 0.92)
|
725
|
-
y2 = bounding_box2["y"] + bounding_box2["height"] / 2
|
726
|
-
page.mouse.click(x2, y2)
|
727
|
-
except:
|
728
|
-
sys.exit("ERROR ADJUSTING SOUND VOLUME: please try again.")
|
729
|
-
|
730
|
-
page.wait_for_selector("div.TUXButton-label:has-text('Save edit')")
|
731
|
-
page.click("div.TUXButton-label:has-text('Save edit')")
|
732
|
-
if suppressprint == False:
|
733
|
-
print("Added sound")
|
734
|
-
|
735
|
-
|
736
|
-
page.wait_for_selector('div[data-contents="true"]')
|
737
|
-
|
738
|
-
if copyrightcheck == True:
|
739
|
-
page.click('div.TUXSwitch:has(label.TUXSwitch-label:has-text("Run a copyright check")) input.TUXSwitch-input')
|
659
|
+
page.locator(".TUXSwitch-input").nth(0).click()
|
740
660
|
while copyrightcheck == True:
|
741
661
|
time.sleep(0.2)
|
742
662
|
if page.locator("span", has_text="No issues detected.").is_visible():
|
@@ -758,7 +678,9 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
758
678
|
break
|
759
679
|
time.sleep(0.2)
|
760
680
|
checks += 1
|
761
|
-
if checks
|
681
|
+
if checks > 100:
|
682
|
+
time.sleep(10)
|
683
|
+
if checks == 150:
|
762
684
|
break
|
763
685
|
else:
|
764
686
|
page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Schedule")', timeout=10000)
|
@@ -766,19 +688,19 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
766
688
|
checks = 0
|
767
689
|
while uploaded == False:
|
768
690
|
if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
|
769
|
-
time.sleep(0.
|
691
|
+
time.sleep(0.2)
|
770
692
|
break
|
771
693
|
time.sleep(0.2)
|
772
694
|
checks += 1
|
773
|
-
if checks
|
695
|
+
if checks > 100:
|
696
|
+
time.sleep(10)
|
697
|
+
if checks == 150:
|
774
698
|
break
|
775
699
|
if suppressprint == False:
|
776
700
|
print("Done uploading video, NOTE: it may take a minute or two to show on TikTok")
|
777
701
|
except:
|
778
|
-
time.sleep(
|
779
|
-
sys.exit("
|
702
|
+
time.sleep(5)
|
703
|
+
sys.exit("ERROR UPLOADING: VIDEO HAS SAVED AS DRAFT BUT CANT UPLOAD")
|
780
704
|
time.sleep(1)
|
781
705
|
|
782
|
-
page.close()
|
783
|
-
|
784
|
-
return "Completed"
|
706
|
+
page.close()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: tiktokautouploader
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.14
|
4
4
|
Summary: Upload or schedule videos to TikTok with viral TikTok sounds and hashtags.
|
5
5
|
Project-URL: Homepage, https://github.com/haziq-exe/TikTokAutoUploader
|
6
6
|
Author-email: HAZIQ <haziqmk123@gmail.com>
|
@@ -17,6 +17,7 @@ Requires-Dist: inference>=0.18.1
|
|
17
17
|
Requires-Dist: pillow>=8.0.0
|
18
18
|
Requires-Dist: playwright>=1.0.0
|
19
19
|
Requires-Dist: requests>=2.0.0
|
20
|
+
Requires-Dist: scikit-learn>=0.24.0
|
20
21
|
Description-Content-Type: text/markdown
|
21
22
|
|
22
23
|
<div align="center">
|
@@ -28,8 +29,9 @@ Description-Content-Type: text/markdown
|
|
28
29
|
|
29
30
|
[](https://pypi.org/project/tiktokautouploader/) [](https://opensource.org/licenses/MIT)
|
30
31
|
|
32
|
+
|
31
33
|
<p align="center">
|
32
|
-
<img src="READMEimage/
|
34
|
+
<img src="READMEimage/READMEvid.gif" alt="" width="900"/>
|
33
35
|
</p>
|
34
36
|
|
35
37
|
## 🚀 Features
|
@@ -42,8 +44,6 @@ Description-Content-Type: text/markdown
|
|
42
44
|
- **⏰ Cutdown on upload time:** Upload to TikTok with way less hassle and much more speed using our library.
|
43
45
|
- **📝 Upload to different accounts:** Stay organized and on top of multiple different accounts with our multi-account functionality.
|
44
46
|
|
45
|
-
⭐️ If you like this project please feel free to star it, Thank you.
|
46
|
-
|
47
47
|
## 📦 Installation
|
48
48
|
|
49
49
|
1. **Python Installation:** Install the package using `pip`:
|
@@ -143,10 +143,4 @@ Created by **Haziq**. Feel free to reach out at [haziqmk123@gmail.com](mailto:ha
|
|
143
143
|
## 📄 License
|
144
144
|
|
145
145
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
|
146
|
-
|
147
|
-
## 📮 Related Projects
|
148
|
-
|
149
|
-
If you liked this project please check out my use case showcase project that generates TikToks and uploads them using 'tiktokautouploader'
|
150
|
-
|
151
|
-
[TikTokGenerator](https://github.com/haziq-exe/TikTokGenerator)
|
152
|
-
|
146
|
+
```
|
@@ -0,0 +1,7 @@
|
|
1
|
+
tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
|
2
|
+
tiktokautouploader/function.py,sha256=vR2ELk1ydps0K9nhA1bxIc2Cf3d5qbvfRm3wUxkDEyk,35292
|
3
|
+
tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
|
4
|
+
tiktokautouploader-3.14.dist-info/METADATA,sha256=9AoqNXOcgyMZyvhgx2bB06uj5uq4caZxge7JyWJbloU,5862
|
5
|
+
tiktokautouploader-3.14.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
|
6
|
+
tiktokautouploader-3.14.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
|
7
|
+
tiktokautouploader-3.14.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
|
2
|
-
tiktokautouploader/function.py,sha256=wH2bcLPMfahox8toEc6L11NtVIE5JHMyj-13VCQPtjw,44652
|
3
|
-
tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
|
4
|
-
tiktokautouploader-3.5.dist-info/METADATA,sha256=uHiOyXy8K0766nma3U1wHcUCs_Nc0-De0S_WerXE7RA,6125
|
5
|
-
tiktokautouploader-3.5.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
|
6
|
-
tiktokautouploader-3.5.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
|
7
|
-
tiktokautouploader-3.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|