tiktokautouploader 2.86__py2.py3-none-any.whl → 2.93__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.
@@ -9,8 +9,7 @@ from PIL import Image
9
9
  import sys
10
10
  import os
11
11
  import warnings
12
- warnings.filterwarnings("ignore")
13
-
12
+ warnings.simplefilter("ignore")
14
13
 
15
14
  def login_warning():
16
15
  print("NO COOKIES FILE FOUND, PLEASE LOG-IN WHEN PROMPTED")
@@ -19,9 +18,27 @@ def save_cookies(cookies):
19
18
  with open('TK_cookies.json', 'w') as file:
20
19
  json.dump(cookies, file, indent=4)
21
20
 
21
+ def check_expiry():
22
+ with open('TK_cookies.json', 'r') as file:
23
+ cookies = json.load(file)
24
+
25
+ current_time = int(time.time())
26
+ cookies_expire = []
27
+ expired = False
28
+ for cookie in cookies:
29
+ if cookie['name'] in ['sessionid', 'sid_tt', 'sessionid_ss', 'passport_auth_status']:
30
+ expiry = cookie.get('expires')
31
+ cookies_expire.append(expiry < current_time)
32
+
33
+ if all(cookies_expire):
34
+ expired = True
35
+
36
+ return expired
37
+
22
38
  def run_javascript():
23
39
  js_file_path = pkg_resources.resource_filename(__name__, 'Js_assets/login.js')
24
40
  result = subprocess.run(['node', js_file_path], capture_output=True, text=True)
41
+ return result
25
42
 
26
43
  def install_js_dependencies():
27
44
  js_dir = pkg_resources.resource_filename(__name__, 'Js_assets')
@@ -30,6 +47,7 @@ def install_js_dependencies():
30
47
  if not os.path.exists(node_modules_path):
31
48
  print("JavaScript dependencies not found. Installing...")
32
49
  subprocess.run(['npm', 'install', 'playwright', 'playwright-extra', 'puppeteer-extra-plugin-stealth', '--silent'], cwd=js_dir, check=True)
50
+ subprocess.run(['npx', 'playwright', 'install', 'chromium'], cwd=js_dir, check=True)
33
51
  else:
34
52
  time.sleep(0.1)
35
53
 
@@ -204,14 +222,19 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
204
222
 
205
223
  retries = 0
206
224
  cookie_read = False
207
- install_js_dependencies()
208
225
 
209
226
  if os.path.exists('TK_cookies.json'):
210
227
  cookies, cookie_read = read_cookies(cookies_path='TK_cookies.json')
228
+ expired = check_expiry()
229
+ if expired == True:
230
+ os.remove('TK_cookies.json')
231
+ print("COOKIES EXPIRED, PLEASE LOG-IN AGAIN")
232
+ cookie_read = False
211
233
 
212
234
  if cookie_read == False:
235
+ install_js_dependencies()
213
236
  login_warning()
214
- run_javascript()
237
+ result = run_javascript()
215
238
 
216
239
  cookies, cookie_read = read_cookies("TK_cookies.json")
217
240
  if cookie_read == False:
@@ -220,13 +243,12 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
220
243
 
221
244
  with sync_playwright() as p:
222
245
 
223
- browser = p.firefox.launch(headless=True)
246
+ browser = p.webkit.launch(headless=False)
224
247
 
225
248
  context = browser.new_context()
226
249
  context.add_cookies(cookies)
227
250
  page = context.new_page()
228
251
  url = 'https://www.tiktok.com/tiktokstudio/upload?from=upload&lang=en'
229
- url2 = 'https://www.tiktok.com/tiktokstudio/content?tab=draft'
230
252
 
231
253
  while retries < 2:
232
254
  try:
@@ -397,7 +419,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
397
419
  time.sleep(0.2)
398
420
  if suppressprint == False:
399
421
  print("Tik tok done loading file onto servers")
400
-
422
+
401
423
  if schedule != None:
402
424
  try:
403
425
  hour = schedule[0:2]
@@ -409,7 +431,13 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
409
431
  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")
410
432
 
411
433
  page.locator('div.TUXRadioStandalone.TUXRadioStandalone--medium').nth(1).click()
412
- time.sleep(0.2)
434
+ time.sleep(1)
435
+ if page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).is_visible():
436
+ page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).click()
437
+ time.sleep(0.2)
438
+ else:
439
+ if page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).is_visible():
440
+ time.sleep(0.2)
413
441
  if day != None:
414
442
  page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).click()
415
443
  time.sleep(0.2)
@@ -437,90 +465,8 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
437
465
 
438
466
  if (schedule == None) and (day != None):
439
467
  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")
440
-
441
-
442
- if(sound_name == None):
443
- if copyrightcheck == True:
444
- page.locator(".TUXSwitch-input").nth(0).click()
445
- while copyrightcheck == True:
446
- time.sleep(0.2)
447
- if page.locator("span", has_text="No issues detected.").is_visible():
448
- if suppressprint == False:
449
- print("Copyright check complete")
450
- break
451
- if page.locator("span", has_text="Copyright issues detected.").is_visible():
452
- sys.exit("COPYRIGHT CHECK FAILED: COPYRIGHT AUDIO DETECTED FROM TIKTOK")
453
-
454
- if schedule == None:
455
- page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Post")', timeout=10000)
456
- uploaded = False
457
- checks = 0
458
- while uploaded == False:
459
- if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
460
- time.sleep(0.2)
461
- break
462
- time.sleep(0.2)
463
- checks += 1
464
- if checks > 100:
465
- time.sleep(10)
466
- if checks == 150:
467
- break
468
- else:
469
- page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Schedule")', timeout=10000)
470
- uploaded = False
471
- checks = 0
472
- while uploaded == False:
473
- if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
474
- time.sleep(0.2)
475
- break
476
- time.sleep(0.2)
477
- checks += 1
478
- if checks > 100:
479
- time.sleep(10)
480
- if checks == 150:
481
- break
482
- if suppressprint == False:
483
- print("Done uploading video, NOTE: it may take a minute or two to show on TikTok")
484
468
 
485
- page.close()
486
-
487
- else:
488
- try:
489
- page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--secondary:has-text("Save draft")', timeout=10000)
490
- except:
491
- sys.exit("SAVE AS DRAFT BUTTON NOT FOUND; CANNOT ADD SOUND WITHOUT ABILITY TO SAVE DRAFTS")
492
-
493
- time.sleep(0.5)
494
- page.close()
495
-
496
- browser = p.chromium.launch(headless=True)
497
-
498
- context = browser.new_context()
499
- context.add_cookies(cookies)
500
- page = context.new_page()
501
- url2 = 'https://www.tiktok.com/tiktokstudio/content?tab=draft'
502
-
503
- while retries < 2:
504
- try:
505
- page.goto(url2, timeout=30000)
506
- except:
507
- retries +=1
508
- time.sleep(5)
509
- if retries == 2:
510
- sys.exit("ERROR: TIK TOK PAGE FAILED TO LOAD, try again.")
511
- else:
512
- break
513
-
514
- try:
515
- 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']")
516
- 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']")
517
- page.wait_for_selector('div[data-contents="true"]')
518
- page.wait_for_function("document.querySelector('.info-progress-num').textContent.trim() === '100%'", timeout=3000000)
519
- time.sleep(0.2)
520
- except:
521
- sys.exit("ERROR ADDING SOUND: Video saved as draft")
522
-
523
- if sound_name != None:
469
+ if sound_name != None:
524
470
  page.click("div.TUXButton-label:has-text('Edit video')")
525
471
  page.wait_for_selector("input.search-bar-input")
526
472
  page.fill(f"input.search-bar-input", f"{sound_name}")
@@ -575,9 +521,9 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
575
521
  if suppressprint == False:
576
522
  print("Added sound")
577
523
 
578
- page.wait_for_selector('div[data-contents="true"]')
524
+ page.wait_for_selector('div[data-contents="true"]')
579
525
 
580
- if copyrightcheck == True:
526
+ if copyrightcheck == True:
581
527
  page.locator(".TUXSwitch-input").nth(0).click()
582
528
  while copyrightcheck == True:
583
529
  time.sleep(0.2)
@@ -589,40 +535,40 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
589
535
  sys.exit("COPYRIGHT CHECK FAILED: VIDEO SAVED AS DRAFT, COPYRIGHT AUDIO DETECTED FROM TIKTOK")
590
536
 
591
537
 
592
- try:
593
- if schedule == None:
594
- page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Post")', timeout=10000)
595
- uploaded = False
596
- checks = 0
597
- while uploaded == False:
598
- if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
599
- time.sleep(0.2)
600
- break
538
+ try:
539
+ if schedule == None:
540
+ page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Post")', timeout=10000)
541
+ uploaded = False
542
+ checks = 0
543
+ while uploaded == False:
544
+ if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
601
545
  time.sleep(0.2)
602
- checks += 1
603
- if checks > 100:
604
- time.sleep(10)
605
- if checks == 150:
606
- break
607
- else:
608
- page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Schedule")', timeout=10000)
609
- uploaded = False
610
- checks = 0
611
- while uploaded == False:
612
- if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
613
- time.sleep(0.2)
614
- break
546
+ break
547
+ time.sleep(0.2)
548
+ checks += 1
549
+ if checks > 100:
550
+ time.sleep(10)
551
+ if checks == 150:
552
+ break
553
+ else:
554
+ page.click('button.TUXButton.TUXButton--default.TUXButton--large.TUXButton--primary:has-text("Schedule")', timeout=10000)
555
+ uploaded = False
556
+ checks = 0
557
+ while uploaded == False:
558
+ if page.locator(':has-text("Leaving the page does not interrupt")').nth(0).is_visible():
615
559
  time.sleep(0.2)
616
- checks += 1
617
- if checks > 100:
618
- time.sleep(10)
619
- if checks == 150:
620
- break
621
- if suppressprint == False:
622
- print("Done uploading video, NOTE: it may take a minute or two to show on TikTok")
623
- except:
624
- time.sleep(5)
625
- sys.exit("ERROR UPLOADING: VIDEO HAS SAVED AS DRAFT BUT CANT UPLOAD")
626
- time.sleep(1)
560
+ break
561
+ time.sleep(0.2)
562
+ checks += 1
563
+ if checks > 100:
564
+ time.sleep(10)
565
+ if checks == 150:
566
+ break
567
+ if suppressprint == False:
568
+ print("Done uploading video, NOTE: it may take a minute or two to show on TikTok")
569
+ except:
570
+ time.sleep(5)
571
+ sys.exit("ERROR UPLOADING: VIDEO HAS SAVED AS DRAFT BUT CANT UPLOAD")
572
+ time.sleep(1)
627
573
 
628
- page.close()
574
+ page.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tiktokautouploader
3
- Version: 2.86
3
+ Version: 2.93
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>
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.8
13
13
  Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
+ Requires-Dist: inference>=0.18.1
16
17
  Requires-Dist: pillow>=8.0.0
17
18
  Requires-Dist: playwright>=1.0.0
18
19
  Requires-Dist: requests>=2.0.0
@@ -30,13 +31,13 @@ Description-Content-Type: text/markdown
30
31
 
31
32
 
32
33
  <p align="center">
33
- <img src="READMEimage/Image.png" alt="" width="400"/>
34
+ <img src="READMEimage/READMEimg.png" alt="" width="150"/>
34
35
  </p>
35
36
 
36
37
  ## 🚀 Features
37
38
 
38
- - **🔐 Bypass/Auto Solve Captchas:** No more manual captcha solving; fully automated process!
39
- - **🎵 Use TikTok Sounds:** Seamlessly add popular TikTok sounds to your videos.
39
+ - **🔐 Bypass/Auto Solve Captchas:** No need to worry about any captchas interrupting the process, they'll be solved!
40
+ - **🎵 Use TikTok Sounds:** Go viral by seamlessly adding popular TikTok sounds to your videos.
40
41
  - **🗓 Schedule Uploads:** Upload videos at specific times or upto 10 days in advance with our scheduling feature.
41
42
  - **🔍 Copyright Check:** Ensure your video is safe from copyright claims before uploading.
42
43
  - **🏷 Add Working Hashtags:** Increase your reach by adding effective hashtags that actually work.
@@ -59,23 +60,22 @@ pip install tiktokautouploader
59
60
  - **Note:** The necessary JavaScript dependencies (`playwright`,`playwright-extra`, `puppeteer-extra-plugin-stealth`) will be AUTOMATICALLY installed the first time you run the function, so you don't need to install them manually. Make sure that `npm` (Node.js package manager) is available in your system's PATH.
60
61
 
61
62
 
62
- 2. **Browser Binaries:** If you don't have them already, you'll need to install the chromium browser binary for `playwright`.
63
+ 2. **Browser Binaries:** If you don't have them already, you'll need to install the browser binaries for `playwright`.
63
64
 
64
- To do so, just run the following command AFTER installing the package:
65
-
66
- ```bash
67
- python -m playwright install chromium
68
- ```
65
+ to do so, just run the following command AFTER installing the package:
66
+
67
+ ```bash
68
+ python -m playwright install
69
+ ```
69
70
 
70
71
 
71
72
  ## 📝 Quick-Start
72
73
 
73
- Here's how to upload a video to TikTok with hashtags using `tiktokautouploader`:
74
-
75
- NOTE: It is highly recommended you read DOCUMENTATION.md before using the library.
76
-
74
+ **NOTE:** It is highly recommended you read DOCUMENTATION.md before using the library.
77
75
  The first time you run the code, you will be prompted to log-in, this will only occur the first time the function is used. Check documentation for more info.
78
76
 
77
+ ## Upload with hashtags
78
+
79
79
  ```python
80
80
  from tiktokautouploader import upload_tiktok
81
81
 
@@ -115,6 +115,7 @@ upload_tiktok(video=video_path, description=description, hashtags=hashtags, copy
115
115
  - **Maximize your reach:** Add popular sounds and effective hashtags that work to boost visibility.
116
116
  - **Stay compliant:** Built-in copyright checks to avoid unforeseen takedowns.
117
117
  - **Convenient scheduling:** Post at the right time, even when you're away.
118
+ - **Much faster than manually uploading:** Drastically reduce the time you need to upload videos, just click one button and be done much quicker!
118
119
 
119
120
  ## 🛠 Dependencies
120
121
 
@@ -130,7 +131,7 @@ These will be automatically installed when you install the package.
130
131
 
131
132
  ## 👤 Author
132
133
 
133
- Created by **Haziq Khalid**. Feel free to reach out at [haziqmk123@gmail.com](mailto:haziqmk123@gmail.com) or my LinkedIn.
134
+ Created by **Haziq**. Feel free to reach out at [haziqmk123@gmail.com](mailto:haziqmk123@gmail.com)
134
135
 
135
136
  ## 📄 License
136
137
 
@@ -0,0 +1,7 @@
1
+ tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
2
+ tiktokautouploader/function.py,sha256=t7_VOwFEKMqykWRdxXwyMaDX1AwmLhQbdILos5_kXks,27776
3
+ tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
4
+ tiktokautouploader-2.93.dist-info/METADATA,sha256=tQhgWlzfM2buP10ypgGfBVAxW_a78RB78saJaucIfl8,5033
5
+ tiktokautouploader-2.93.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
6
+ tiktokautouploader-2.93.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
7
+ tiktokautouploader-2.93.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
2
- tiktokautouploader/function.py,sha256=7pZ--_6IyX69Ayf-rzXMd9PlzqzcVwAFrljIk8MwACI,31506
3
- tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
4
- tiktokautouploader-2.86.dist-info/METADATA,sha256=cSuoQsxyjQfK4pzJLf7eqoCf4nDp9bOESwDBHJS1l3Q,4879
5
- tiktokautouploader-2.86.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
6
- tiktokautouploader-2.86.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
7
- tiktokautouploader-2.86.dist-info/RECORD,,