tiktokautouploader 2.95__py2.py3-none-any.whl → 2.98__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 +44 -16
- {tiktokautouploader-2.95.dist-info → tiktokautouploader-2.98.dist-info}/METADATA +8 -3
- tiktokautouploader-2.98.dist-info/RECORD +7 -0
- tiktokautouploader-2.95.dist-info/RECORD +0 -7
- {tiktokautouploader-2.95.dist-info → tiktokautouploader-2.98.dist-info}/WHEEL +0 -0
- {tiktokautouploader-2.95.dist-info → tiktokautouploader-2.98.dist-info}/licenses/LICENSE.md +0 -0
tiktokautouploader/function.py
CHANGED
@@ -11,15 +11,26 @@ import os
|
|
11
11
|
import warnings
|
12
12
|
warnings.simplefilter("ignore")
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
def check_for_updates():
|
16
|
+
current_version = pkg_resources.get_distribution("tiktokautouploader").version
|
17
|
+
response = requests.get("https://pypi.org/pypi/tiktokautouploader/json")
|
18
|
+
|
19
|
+
if response.status_code == 200:
|
20
|
+
latest_version = response.json()["info"]["version"]
|
21
|
+
if current_version != latest_version:
|
22
|
+
print(f"WARNING: You are using version {current_version} of tiktokautouploader, "
|
23
|
+
f"PLEASE UPDATE TO LATEST VERSION {latest_version} FOR BEST EXPERIENCE.")
|
24
|
+
|
25
|
+
def login_warning(accountname):
|
26
|
+
print(f"NO COOKIES FILE FOUND FOR ACCOUNT {accountname}, PLEASE LOG-IN TO {accountname} WHEN PROMPTED")
|
16
27
|
|
17
28
|
def save_cookies(cookies):
|
18
29
|
with open('TK_cookies.json', 'w') as file:
|
19
30
|
json.dump(cookies, file, indent=4)
|
20
31
|
|
21
|
-
def check_expiry():
|
22
|
-
with open('
|
32
|
+
def check_expiry(accountname):
|
33
|
+
with open(f'TK_cookies_{accountname}.json', 'r') as file:
|
23
34
|
cookies = json.load(file)
|
24
35
|
|
25
36
|
current_time = int(time.time())
|
@@ -212,7 +223,7 @@ def click_on_objects(page, object_coords):
|
|
212
223
|
|
213
224
|
|
214
225
|
|
215
|
-
def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_vol='mix', schedule=None, day=None, copyrightcheck=False, suppressprint=False):
|
226
|
+
def upload_tiktok(video, description, accountname, hashtags=None, sound_name=None, sound_aud_vol='mix', schedule=None, day=None, copyrightcheck=False, suppressprint=False):
|
216
227
|
|
217
228
|
"""
|
218
229
|
UPLOADS VIDEO TO TIKTOK
|
@@ -228,38 +239,49 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
228
239
|
suppressprint (bool) -> True means function doesnt print anything to provide updates on progress
|
229
240
|
--------------------------------------------------------------------------------------------------------------------------------------------
|
230
241
|
"""
|
242
|
+
try:
|
243
|
+
check_for_updates()
|
244
|
+
except:
|
245
|
+
time.sleep(0.1)
|
231
246
|
|
232
247
|
retries = 0
|
233
248
|
cookie_read = False
|
234
249
|
oldQ = 'N.A'
|
235
250
|
|
236
|
-
if
|
237
|
-
|
238
|
-
|
251
|
+
if accountname == None:
|
252
|
+
sys.exit("PLEASE ENTER NAME OF ACCOUNT TO POST ON, READ DOCUMENTATION FOR MORE INFO")
|
253
|
+
|
254
|
+
if os.path.exists(f'TK_cookies_{accountname}.json'):
|
255
|
+
cookies, cookie_read = read_cookies(cookies_path=f'TK_cookies_{accountname}.json')
|
256
|
+
expired = check_expiry(accountname=accountname)
|
239
257
|
if expired == True:
|
240
|
-
os.remove('
|
241
|
-
print("COOKIES EXPIRED, PLEASE LOG-IN AGAIN")
|
258
|
+
os.remove(f'TK_cookies_{accountname}.json')
|
259
|
+
print(f"COOKIES EXPIRED FOR ACCOUNT {accountname}, PLEASE LOG-IN AGAIN")
|
242
260
|
cookie_read = False
|
243
261
|
|
244
262
|
if cookie_read == False:
|
245
263
|
install_js_dependencies()
|
246
|
-
login_warning()
|
264
|
+
login_warning(accountname=accountname)
|
247
265
|
result = run_javascript()
|
266
|
+
os.rename('TK_cookies.json', f'TK_cookies_{accountname}.json')
|
248
267
|
|
249
|
-
cookies, cookie_read = read_cookies("
|
268
|
+
cookies, cookie_read = read_cookies(f"TK_cookies_{accountname}.json")
|
250
269
|
if cookie_read == False:
|
251
270
|
sys.exit("ERROR READING COOKIES")
|
252
271
|
|
253
|
-
|
272
|
+
|
254
273
|
with sync_playwright() as p:
|
255
274
|
|
256
|
-
browser = p.
|
275
|
+
browser = p.firefox.launch(headless=True)
|
257
276
|
|
258
277
|
context = browser.new_context()
|
259
278
|
context.add_cookies(cookies)
|
260
279
|
page = context.new_page()
|
261
280
|
url = 'https://www.tiktok.com/tiktokstudio/upload?from=upload&lang=en'
|
262
281
|
|
282
|
+
if suppressprint == False:
|
283
|
+
print(f"Uploading to account '{accountname}'")
|
284
|
+
|
263
285
|
while retries < 2:
|
264
286
|
try:
|
265
287
|
page.goto(url, timeout=30000)
|
@@ -298,7 +320,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
298
320
|
question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
|
299
321
|
if time.time() - start_time > 2:
|
300
322
|
break
|
301
|
-
if 'Select 2 objects that are the same' in question:
|
323
|
+
if 'Select 2 objects that are the same' in question or 'Select two objects that are the same' in question:
|
302
324
|
found = False
|
303
325
|
while found == False:
|
304
326
|
page.click('span.secsdk_captcha_refresh--text')
|
@@ -319,7 +341,10 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
319
341
|
image_width_real, image_height_real = image_size
|
320
342
|
|
321
343
|
webpage_coords = convert_to_webpage_coordinates(b_box, image_x, image_y, image_height_web, image_width_web, image_height_real, image_width_real)
|
344
|
+
if not webpage_coords:
|
345
|
+
webpage_coords.append((image_x + 50, image_y + 50))
|
322
346
|
click_on_objects(page, webpage_coords)
|
347
|
+
page.click("div.verify-captcha-submit-button")
|
323
348
|
time.sleep(0.5)
|
324
349
|
if attempts > 5:
|
325
350
|
sys.exit("FAILED TO SOLVE CAPTCHA")
|
@@ -327,6 +352,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
327
352
|
if page.locator("div.captcha_verify_message.captcha_verify_message-pass").is_visible():
|
328
353
|
solved = True
|
329
354
|
showedup = True
|
355
|
+
os.remove('captcha_image.jpg')
|
330
356
|
if page.locator("div.captcha_verify_message.captcha_verify_message-fail").is_visible():
|
331
357
|
showedup = True
|
332
358
|
oldQ = question
|
@@ -363,9 +389,11 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
363
389
|
image_width_real, image_height_real = image_size
|
364
390
|
|
365
391
|
webpage_coords = convert_to_webpage_coordinates(b_box, image_x, image_y, image_height_web, image_width_web, image_height_real, image_width_real)
|
366
|
-
|
392
|
+
if not webpage_coords:
|
393
|
+
webpage_coords.append((image_x + 50, image_y + 50))
|
367
394
|
click_on_objects(page, webpage_coords)
|
368
395
|
page.click("div.verify-captcha-submit-button")
|
396
|
+
time.sleep(1)
|
369
397
|
if attempts > 20:
|
370
398
|
sys.exit("FAILED TO SOLVE CAPTCHA")
|
371
399
|
showedup = False
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: tiktokautouploader
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.98
|
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,7 +31,7 @@ Description-Content-Type: text/markdown
|
|
31
31
|
|
32
32
|
|
33
33
|
<p align="center">
|
34
|
-
<img src="READMEimage/
|
34
|
+
<img src="READMEimage/READMEvid.gif" alt="" width="900"/>
|
35
35
|
</p>
|
36
36
|
|
37
37
|
## 🚀 Features
|
@@ -41,6 +41,7 @@ Description-Content-Type: text/markdown
|
|
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.
|
44
|
+
- **⏰ Cutdown on upload time:** Upload to TikTok with way less hassle and much more speed using our library
|
44
45
|
|
45
46
|
|
46
47
|
## 📦 Installation
|
@@ -51,6 +52,8 @@ Description-Content-Type: text/markdown
|
|
51
52
|
pip install tiktokautouploader
|
52
53
|
```
|
53
54
|
|
55
|
+
**NOTE:** IF YOU HAVE INSTALLED BEFORE, PLEASE MAKE SURE YOU HAVE LATEST VERSION INSTALLED OR ELSE YOU MIGHT FACE BUGS
|
56
|
+
|
54
57
|
---
|
55
58
|
|
56
59
|
## ⚙️ Pre-requisites
|
@@ -60,7 +63,7 @@ pip install tiktokautouploader
|
|
60
63
|
- **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
64
|
|
62
65
|
|
63
|
-
2. **Browser Binaries:** If you don't have them already, you'll need to install the browser binaries for `playwright`.
|
66
|
+
2. **Browser Binaries:** If you don't have them already, you'll need to install the browser binaries for `playwright`. This library uses chromium and firefox.
|
64
67
|
|
65
68
|
to do so, just run the following command AFTER installing the package:
|
66
69
|
|
@@ -68,6 +71,8 @@ pip install tiktokautouploader
|
|
68
71
|
python -m playwright install
|
69
72
|
```
|
70
73
|
|
74
|
+
**NOTE:** If you want to add sounds to your TikTok, you MUST have the ability to save drafts. If you don't want to add sounds then you don't need this feature.
|
75
|
+
|
71
76
|
|
72
77
|
## 📝 Quick-Start
|
73
78
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
|
2
|
+
tiktokautouploader/function.py,sha256=wUI4r8dPIj6eSyi2WvBFJHb3zYyNAPonw_xrrMtJvBQ,35203
|
3
|
+
tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
|
4
|
+
tiktokautouploader-2.98.dist-info/METADATA,sha256=NXjc7EasXewxxIrnTJSb295_-UD9Q4-AcA5aKy5Jt98,5464
|
5
|
+
tiktokautouploader-2.98.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
|
6
|
+
tiktokautouploader-2.98.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
|
7
|
+
tiktokautouploader-2.98.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
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,,
|
File without changes
|
File without changes
|