tiktokautouploader 2.91__py2.py3-none-any.whl → 2.95__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,7 +9,7 @@ from PIL import Image
9
9
  import sys
10
10
  import os
11
11
  import warnings
12
- warnings.filterwarnings("ignore")
12
+ warnings.simplefilter("ignore")
13
13
 
14
14
  def login_warning():
15
15
  print("NO COOKIES FILE FOUND, PLEASE LOG-IN WHEN PROMPTED")
@@ -38,6 +38,7 @@ def check_expiry():
38
38
  def run_javascript():
39
39
  js_file_path = pkg_resources.resource_filename(__name__, 'Js_assets/login.js')
40
40
  result = subprocess.run(['node', js_file_path], capture_output=True, text=True)
41
+ return result
41
42
 
42
43
  def install_js_dependencies():
43
44
  js_dir = pkg_resources.resource_filename(__name__, 'Js_assets')
@@ -46,6 +47,7 @@ def install_js_dependencies():
46
47
  if not os.path.exists(node_modules_path):
47
48
  print("JavaScript dependencies not found. Installing...")
48
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)
49
51
  else:
50
52
  time.sleep(0.1)
51
53
 
@@ -86,11 +88,24 @@ def understood_Qs(question):
86
88
  'has strings': 'guitar',
87
89
  'oval and inflatable': 'football',
88
90
  'strumming': 'guitar',
89
- 'bounces on courts': 'basketball',
91
+ 'bounces': 'basketball',
90
92
  'musical instrument': 'guitar',
91
93
  'laces': 'football',
92
94
  'bands': 'guitar',
93
- 'leather': 'football'
95
+ 'leather': 'football',
96
+ 'leaves':'tree',
97
+ 'pages': 'book',
98
+ 'throwing': 'football',
99
+ 'tossed in a spiral': 'football',
100
+ 'spiky crown': 'pineapple',
101
+ 'pigskin': 'football',
102
+ 'photography': 'camera',
103
+ 'lens': 'camera',
104
+ 'grow': 'tree',
105
+ 'captures images': 'camera',
106
+ 'keeps doctors': 'apple',
107
+ 'crown': 'pineapple',
108
+ 'driven': 'car',
94
109
  }
95
110
 
96
111
  for key in understood_terms.keys():
@@ -116,8 +131,7 @@ def download_image(image_url):
116
131
 
117
132
  def run_inference_on_image_tougher(image_path, object):
118
133
 
119
- found_proper = False
120
- model = inference.get_model("captcha-2-6ehbe/1")
134
+ model = inference.get_model("captcha-2-6ehbe/2")
121
135
  results = model.infer(image=image_path)
122
136
 
123
137
  class_names = []
@@ -137,12 +151,9 @@ def run_inference_on_image_tougher(image_path, object):
137
151
  if classes == class_to_click:
138
152
  bounding_box.append(bounding_boxes[i])
139
153
 
140
- if len(bounding_box) == 2:
141
- found_proper = True
142
154
 
143
- found_proper = True
144
155
 
145
- return bounding_box, found_proper
156
+ return bounding_box
146
157
 
147
158
  def run_inference_on_image(image_path):
148
159
 
@@ -220,7 +231,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
220
231
 
221
232
  retries = 0
222
233
  cookie_read = False
223
- install_js_dependencies()
234
+ oldQ = 'N.A'
224
235
 
225
236
  if os.path.exists('TK_cookies.json'):
226
237
  cookies, cookie_read = read_cookies(cookies_path='TK_cookies.json')
@@ -231,8 +242,9 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
231
242
  cookie_read = False
232
243
 
233
244
  if cookie_read == False:
245
+ install_js_dependencies()
234
246
  login_warning()
235
- run_javascript()
247
+ result = run_javascript()
236
248
 
237
249
  cookies, cookie_read = read_cookies("TK_cookies.json")
238
250
  if cookie_read == False:
@@ -241,13 +253,12 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
241
253
 
242
254
  with sync_playwright() as p:
243
255
 
244
- browser = p.firefox.launch(headless=True)
256
+ browser = p.webkit.launch(headless=False)
245
257
 
246
258
  context = browser.new_context()
247
259
  context.add_cookies(cookies)
248
260
  page = context.new_page()
249
261
  url = 'https://www.tiktok.com/tiktokstudio/upload?from=upload&lang=en'
250
- url2 = 'https://www.tiktok.com/tiktokstudio/content?tab=draft'
251
262
 
252
263
  while retries < 2:
253
264
  try:
@@ -279,24 +290,28 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
279
290
  print("CAPTCHA DETECTED, Attempting to solve")
280
291
  solved = False
281
292
  attempts = 0
293
+ question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
282
294
  while solved == False:
283
295
  attempts += 1
284
- question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
296
+ start_time = time.time()
297
+ while question == oldQ:
298
+ question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
299
+ if time.time() - start_time > 2:
300
+ break
285
301
  if 'Select 2 objects that are the same' in question:
286
302
  found = False
287
303
  while found == False:
288
304
  page.click('span.secsdk_captcha_refresh--text')
289
- time.sleep(0.5)
290
305
  image = get_image_src(page)
291
306
  img_path = download_image(image)
292
307
  b_box, found = run_inference_on_image(image_path=img_path)
293
308
 
294
309
  with Image.open(img_path) as img:
295
310
  image_size = img.size
296
-
297
- image = page.locator('#captcha-verify-image')
298
- image.wait_for()
299
- box = image.bounding_box()
311
+
312
+ imageweb = page.locator('#captcha-verify-image')
313
+ imageweb.wait_for()
314
+ box = imageweb.bounding_box()
300
315
  image_x = box['x']
301
316
  image_y = box['y']
302
317
  image_height_web = box['height']
@@ -308,36 +323,39 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
308
323
  time.sleep(0.5)
309
324
  if attempts > 5:
310
325
  sys.exit("FAILED TO SOLVE CAPTCHA")
311
- try:
312
- page.wait_for_selector('.upload-text-container', timeout=5000)
313
- os.remove('captcha_image.jpg')
314
- if suppressprint == False:
315
- print("Captcha Solved")
316
- solved = True
317
- except:
318
- continue
326
+ while showedup == False:
327
+ if page.locator("div.captcha_verify_message.captcha_verify_message-pass").is_visible():
328
+ solved = True
329
+ showedup = True
330
+ if page.locator("div.captcha_verify_message.captcha_verify_message-fail").is_visible():
331
+ showedup = True
332
+ oldQ = question
333
+ page.click('span.secsdk_captcha_refresh--text')
319
334
  else:
320
- found_prop = False
321
- while found_prop == False:
335
+ objectclick = understood_Qs(question)
336
+ while objectclick == 'N.A':
337
+ oldQ = question
322
338
  page.click('span.secsdk_captcha_refresh--text')
323
- time.sleep(0.5)
324
- question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
325
- objectclick = understood_Qs(question)
326
- while objectclick == 'N.A':
327
- page.click('span.secsdk_captcha_refresh--text')
328
- page.wait_for_selector('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT')
339
+ start_time = time.time()
340
+ runs = 0
341
+ while question == oldQ:
342
+ runs += 1
329
343
  question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
330
- objectclick = understood_Qs(question)
331
- image = get_image_src(page)
332
- img_path = download_image(image)
333
- b_box, found_prop = run_inference_on_image_tougher(image_path=img_path, object=objectclick)
334
-
344
+ if runs > 1:
345
+ time.sleep(1)
346
+ if time.time() - start_time > 2:
347
+ break
348
+ objectclick = understood_Qs(question)
349
+ image = get_image_src(page)
350
+ img_path = download_image(image)
351
+ b_box = run_inference_on_image_tougher(image_path=img_path, object=objectclick)
352
+
335
353
  with Image.open(img_path) as img:
336
354
  image_size = img.size
337
-
338
- image = page.locator('#captcha-verify-image')
339
- image.wait_for()
340
- box = image.bounding_box()
355
+
356
+ imageweb = page.locator('#captcha-verify-image')
357
+ imageweb.wait_for()
358
+ box = imageweb.bounding_box()
341
359
  image_x = box['x']
342
360
  image_y = box['y']
343
361
  image_height_web = box['height']
@@ -346,20 +364,22 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
346
364
 
347
365
  webpage_coords = convert_to_webpage_coordinates(b_box, image_x, image_y, image_height_web, image_width_web, image_height_real, image_width_real)
348
366
 
349
-
350
367
  click_on_objects(page, webpage_coords)
351
- time.sleep(0.5)
352
368
  page.click("div.verify-captcha-submit-button")
353
- if attempts > 10:
369
+ if attempts > 20:
354
370
  sys.exit("FAILED TO SOLVE CAPTCHA")
355
- try:
356
- page.wait_for_selector('.upload-text-container', timeout=5000)
357
- solved = True
358
- os.remove('captcha_image.jpg')
359
- if suppressprint == False:
360
- print("Captcha Solved")
361
- except:
362
- continue
371
+ showedup = False
372
+ while showedup == False:
373
+ if page.locator("div.captcha_verify_message.captcha_verify_message-pass").is_visible():
374
+ solved = True
375
+ showedup = True
376
+ os.remove('captcha_image.jpg')
377
+ if suppressprint == False:
378
+ print("CAPTCHA SOLVED")
379
+ if page.locator("div.captcha_verify_message.captcha_verify_message-fail").is_visible():
380
+ showedup = True
381
+ oldQ = question
382
+ page.click('span.secsdk_captcha_refresh--text')
363
383
 
364
384
 
365
385
  try:
@@ -418,7 +438,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
418
438
  time.sleep(0.2)
419
439
  if suppressprint == False:
420
440
  print("Tik tok done loading file onto servers")
421
-
441
+
422
442
  if schedule != None:
423
443
  try:
424
444
  hour = schedule[0:2]
@@ -465,7 +485,6 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
465
485
  if (schedule == None) and (day != None):
466
486
  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")
467
487
 
468
-
469
488
  if(sound_name == None):
470
489
  if copyrightcheck == True:
471
490
  page.locator(".TUXSwitch-input").nth(0).click()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tiktokautouploader
3
- Version: 2.91
3
+ Version: 2.95
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>
@@ -31,13 +31,13 @@ Description-Content-Type: text/markdown
31
31
 
32
32
 
33
33
  <p align="center">
34
- <img src="READMEimage/Image.png" alt="" width="400"/>
34
+ <img src="READMEimage/READMEimg.png" alt="" width="150"/>
35
35
  </p>
36
36
 
37
37
  ## 🚀 Features
38
38
 
39
- - **🔐 Bypass/Auto Solve Captchas:** No more manual captcha solving; fully automated process!
40
- - **🎵 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.
41
41
  - **🗓 Schedule Uploads:** Upload videos at specific times or upto 10 days in advance with our scheduling feature.
42
42
  - **🔍 Copyright Check:** Ensure your video is safe from copyright claims before uploading.
43
43
  - **🏷 Add Working Hashtags:** Increase your reach by adding effective hashtags that actually work.
@@ -60,23 +60,22 @@ pip install tiktokautouploader
60
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.
61
61
 
62
62
 
63
- 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`.
64
64
 
65
- To do so, just run the following command AFTER installing the package:
66
-
67
- ```bash
68
- python -m playwright install chromium
69
- ```
65
+ to do so, just run the following command AFTER installing the package:
66
+
67
+ ```bash
68
+ python -m playwright install
69
+ ```
70
70
 
71
71
 
72
72
  ## 📝 Quick-Start
73
73
 
74
- Here's how to upload a video to TikTok with hashtags using `tiktokautouploader`:
75
-
76
- NOTE: It is highly recommended you read DOCUMENTATION.md before using the library.
77
-
74
+ **NOTE:** It is highly recommended you read DOCUMENTATION.md before using the library.
78
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.
79
76
 
77
+ ## Upload with hashtags
78
+
80
79
  ```python
81
80
  from tiktokautouploader import upload_tiktok
82
81
 
@@ -116,6 +115,7 @@ upload_tiktok(video=video_path, description=description, hashtags=hashtags, copy
116
115
  - **Maximize your reach:** Add popular sounds and effective hashtags that work to boost visibility.
117
116
  - **Stay compliant:** Built-in copyright checks to avoid unforeseen takedowns.
118
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!
119
119
 
120
120
  ## 🛠 Dependencies
121
121
 
@@ -131,7 +131,7 @@ These will be automatically installed when you install the package.
131
131
 
132
132
  ## 👤 Author
133
133
 
134
- 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)
135
135
 
136
136
  ## 📄 License
137
137
 
@@ -0,0 +1,7 @@
1
+ tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
2
+ tiktokautouploader/function.py,sha256=PhHDU2GqteX5MqsPYQiyYfT09XHbLSG3_ydH9j4QHJE,33619
3
+ tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
4
+ tiktokautouploader-2.95.dist-info/METADATA,sha256=5fJDsAptfF53htSHKekKk8JGcoWdrS58LS-sucWOj30,5033
5
+ tiktokautouploader-2.95.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
6
+ tiktokautouploader-2.95.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
7
+ tiktokautouploader-2.95.dist-info/RECORD,,
@@ -1,7 +0,0 @@
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,,