tiktokautouploader 2.86__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.
- tiktokautouploader/function.py +105 -59
- {tiktokautouploader-2.86.dist-info → tiktokautouploader-2.95.dist-info}/METADATA +16 -15
- tiktokautouploader-2.95.dist-info/RECORD +7 -0
- tiktokautouploader-2.86.dist-info/RECORD +0 -7
- {tiktokautouploader-2.86.dist-info → tiktokautouploader-2.95.dist-info}/WHEEL +0 -0
- {tiktokautouploader-2.86.dist-info → tiktokautouploader-2.95.dist-info}/licenses/LICENSE.md +0 -0
tiktokautouploader/function.py
CHANGED
@@ -9,8 +9,7 @@ from PIL import Image
|
|
9
9
|
import sys
|
10
10
|
import os
|
11
11
|
import warnings
|
12
|
-
warnings.
|
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
|
|
@@ -70,11 +88,24 @@ def understood_Qs(question):
|
|
70
88
|
'has strings': 'guitar',
|
71
89
|
'oval and inflatable': 'football',
|
72
90
|
'strumming': 'guitar',
|
73
|
-
'bounces
|
91
|
+
'bounces': 'basketball',
|
74
92
|
'musical instrument': 'guitar',
|
75
93
|
'laces': 'football',
|
76
94
|
'bands': 'guitar',
|
77
|
-
'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',
|
78
109
|
}
|
79
110
|
|
80
111
|
for key in understood_terms.keys():
|
@@ -100,8 +131,7 @@ def download_image(image_url):
|
|
100
131
|
|
101
132
|
def run_inference_on_image_tougher(image_path, object):
|
102
133
|
|
103
|
-
|
104
|
-
model = inference.get_model("captcha-2-6ehbe/1")
|
134
|
+
model = inference.get_model("captcha-2-6ehbe/2")
|
105
135
|
results = model.infer(image=image_path)
|
106
136
|
|
107
137
|
class_names = []
|
@@ -121,12 +151,9 @@ def run_inference_on_image_tougher(image_path, object):
|
|
121
151
|
if classes == class_to_click:
|
122
152
|
bounding_box.append(bounding_boxes[i])
|
123
153
|
|
124
|
-
if len(bounding_box) == 2:
|
125
|
-
found_proper = True
|
126
154
|
|
127
|
-
found_proper = True
|
128
155
|
|
129
|
-
return bounding_box
|
156
|
+
return bounding_box
|
130
157
|
|
131
158
|
def run_inference_on_image(image_path):
|
132
159
|
|
@@ -204,14 +231,20 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
204
231
|
|
205
232
|
retries = 0
|
206
233
|
cookie_read = False
|
207
|
-
|
234
|
+
oldQ = 'N.A'
|
208
235
|
|
209
236
|
if os.path.exists('TK_cookies.json'):
|
210
237
|
cookies, cookie_read = read_cookies(cookies_path='TK_cookies.json')
|
238
|
+
expired = check_expiry()
|
239
|
+
if expired == True:
|
240
|
+
os.remove('TK_cookies.json')
|
241
|
+
print("COOKIES EXPIRED, PLEASE LOG-IN AGAIN")
|
242
|
+
cookie_read = False
|
211
243
|
|
212
244
|
if cookie_read == False:
|
245
|
+
install_js_dependencies()
|
213
246
|
login_warning()
|
214
|
-
run_javascript()
|
247
|
+
result = run_javascript()
|
215
248
|
|
216
249
|
cookies, cookie_read = read_cookies("TK_cookies.json")
|
217
250
|
if cookie_read == False:
|
@@ -220,13 +253,12 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
220
253
|
|
221
254
|
with sync_playwright() as p:
|
222
255
|
|
223
|
-
browser = p.
|
256
|
+
browser = p.webkit.launch(headless=False)
|
224
257
|
|
225
258
|
context = browser.new_context()
|
226
259
|
context.add_cookies(cookies)
|
227
260
|
page = context.new_page()
|
228
261
|
url = 'https://www.tiktok.com/tiktokstudio/upload?from=upload&lang=en'
|
229
|
-
url2 = 'https://www.tiktok.com/tiktokstudio/content?tab=draft'
|
230
262
|
|
231
263
|
while retries < 2:
|
232
264
|
try:
|
@@ -258,24 +290,28 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
258
290
|
print("CAPTCHA DETECTED, Attempting to solve")
|
259
291
|
solved = False
|
260
292
|
attempts = 0
|
293
|
+
question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
|
261
294
|
while solved == False:
|
262
295
|
attempts += 1
|
263
|
-
|
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
|
264
301
|
if 'Select 2 objects that are the same' in question:
|
265
302
|
found = False
|
266
303
|
while found == False:
|
267
304
|
page.click('span.secsdk_captcha_refresh--text')
|
268
|
-
time.sleep(0.5)
|
269
305
|
image = get_image_src(page)
|
270
306
|
img_path = download_image(image)
|
271
307
|
b_box, found = run_inference_on_image(image_path=img_path)
|
272
308
|
|
273
309
|
with Image.open(img_path) as img:
|
274
310
|
image_size = img.size
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
box =
|
311
|
+
|
312
|
+
imageweb = page.locator('#captcha-verify-image')
|
313
|
+
imageweb.wait_for()
|
314
|
+
box = imageweb.bounding_box()
|
279
315
|
image_x = box['x']
|
280
316
|
image_y = box['y']
|
281
317
|
image_height_web = box['height']
|
@@ -287,36 +323,39 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
287
323
|
time.sleep(0.5)
|
288
324
|
if attempts > 5:
|
289
325
|
sys.exit("FAILED TO SOLVE CAPTCHA")
|
290
|
-
|
291
|
-
page.
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
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')
|
298
334
|
else:
|
299
|
-
|
300
|
-
while
|
335
|
+
objectclick = understood_Qs(question)
|
336
|
+
while objectclick == 'N.A':
|
337
|
+
oldQ = question
|
301
338
|
page.click('span.secsdk_captcha_refresh--text')
|
302
|
-
time.
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
page.click('span.secsdk_captcha_refresh--text')
|
307
|
-
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
|
308
343
|
question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
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
|
+
|
314
353
|
with Image.open(img_path) as img:
|
315
354
|
image_size = img.size
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
box =
|
355
|
+
|
356
|
+
imageweb = page.locator('#captcha-verify-image')
|
357
|
+
imageweb.wait_for()
|
358
|
+
box = imageweb.bounding_box()
|
320
359
|
image_x = box['x']
|
321
360
|
image_y = box['y']
|
322
361
|
image_height_web = box['height']
|
@@ -325,20 +364,22 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
325
364
|
|
326
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)
|
327
366
|
|
328
|
-
|
329
367
|
click_on_objects(page, webpage_coords)
|
330
|
-
time.sleep(0.5)
|
331
368
|
page.click("div.verify-captcha-submit-button")
|
332
|
-
if attempts >
|
369
|
+
if attempts > 20:
|
333
370
|
sys.exit("FAILED TO SOLVE CAPTCHA")
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
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')
|
342
383
|
|
343
384
|
|
344
385
|
try:
|
@@ -397,7 +438,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
397
438
|
time.sleep(0.2)
|
398
439
|
if suppressprint == False:
|
399
440
|
print("Tik tok done loading file onto servers")
|
400
|
-
|
441
|
+
|
401
442
|
if schedule != None:
|
402
443
|
try:
|
403
444
|
hour = schedule[0:2]
|
@@ -409,7 +450,13 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
409
450
|
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
451
|
|
411
452
|
page.locator('div.TUXRadioStandalone.TUXRadioStandalone--medium').nth(1).click()
|
412
|
-
time.sleep(
|
453
|
+
time.sleep(1)
|
454
|
+
if page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).is_visible():
|
455
|
+
page.locator('button.TUXButton.TUXButton--default.TUXButton--medium.TUXButton--primary:has-text("Allow")').nth(0).click()
|
456
|
+
time.sleep(0.2)
|
457
|
+
else:
|
458
|
+
if page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).is_visible():
|
459
|
+
time.sleep(0.2)
|
413
460
|
if day != None:
|
414
461
|
page.locator('div.TUXTextInputCore-trailingIconWrapper').nth(1).click()
|
415
462
|
time.sleep(0.2)
|
@@ -438,7 +485,6 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
438
485
|
if (schedule == None) and (day != None):
|
439
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")
|
440
487
|
|
441
|
-
|
442
488
|
if(sound_name == None):
|
443
489
|
if copyrightcheck == True:
|
444
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.
|
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>
|
@@ -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/
|
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
|
39
|
-
- **🎵 Use TikTok Sounds:**
|
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
|
63
|
+
2. **Browser Binaries:** If you don't have them already, you'll need to install the browser binaries for `playwright`.
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
```bash
|
67
|
-
python -m playwright install
|
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
|
-
|
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
|
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=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=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,,
|
File without changes
|
File without changes
|