tiktokautouploader 2.85__py2.py3-none-any.whl → 2.91__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.
@@ -11,7 +11,6 @@ import os
11
11
  import warnings
12
12
  warnings.filterwarnings("ignore")
13
13
 
14
-
15
14
  def login_warning():
16
15
  print("NO COOKIES FILE FOUND, PLEASE LOG-IN WHEN PROMPTED")
17
16
 
@@ -19,6 +18,23 @@ 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)
@@ -204,12 +220,17 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
204
220
 
205
221
  retries = 0
206
222
  cookie_read = False
223
+ install_js_dependencies()
207
224
 
208
225
  if os.path.exists('TK_cookies.json'):
209
226
  cookies, cookie_read = read_cookies(cookies_path='TK_cookies.json')
227
+ expired = check_expiry()
228
+ if expired == True:
229
+ os.remove('TK_cookies.json')
230
+ print("COOKIES EXPIRED, PLEASE LOG-IN AGAIN")
231
+ cookie_read = False
210
232
 
211
233
  if cookie_read == False:
212
- install_js_dependencies()
213
234
  login_warning()
214
235
  run_javascript()
215
236
 
@@ -329,7 +350,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
329
350
  click_on_objects(page, webpage_coords)
330
351
  time.sleep(0.5)
331
352
  page.click("div.verify-captcha-submit-button")
332
- if attempts > 5:
353
+ if attempts > 10:
333
354
  sys.exit("FAILED TO SOLVE CAPTCHA")
334
355
  try:
335
356
  page.wait_for_selector('.upload-text-container', timeout=5000)
@@ -409,7 +430,13 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
409
430
  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
431
 
411
432
  page.locator('div.TUXRadioStandalone.TUXRadioStandalone--medium').nth(1).click()
412
- time.sleep(0.2)
433
+ time.sleep(1)
434
+ if page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).is_visible():
435
+ page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).click()
436
+ time.sleep(0.2)
437
+ else:
438
+ if page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).is_visible():
439
+ time.sleep(0.2)
413
440
  if day != None:
414
441
  page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).click()
415
442
  time.sleep(0.2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tiktokautouploader
3
- Version: 2.85
3
+ Version: 2.91
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
@@ -0,0 +1,7 @@
1
+ tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
2
+ tiktokautouploader/function.py,sha256=xH9h_yIxwuUo-CfvR1NpHDyGBhrS-6n-enNMx1l2Dqw,32635
3
+ tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
4
+ tiktokautouploader-2.91.dist-info/METADATA,sha256=ZoRMgMxspM1jBl-keLV6Y8JspObu8dUiahKYyFaY0KQ,4912
5
+ tiktokautouploader-2.91.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
6
+ tiktokautouploader-2.91.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
7
+ tiktokautouploader-2.91.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
2
- tiktokautouploader/function.py,sha256=6v89pLpulCIYD6KjfN_rphFUVGclGvnQBlNsoxBPU7Q,31509
3
- tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
4
- tiktokautouploader-2.85.dist-info/METADATA,sha256=0SUpoRf0G6kdkLe0YDL8x3T6GB0Cd6EVvCheOwq0nKU,4879
5
- tiktokautouploader-2.85.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
6
- tiktokautouploader-2.85.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
7
- tiktokautouploader-2.85.dist-info/RECORD,,