tiktokautouploader 2.91__tar.gz → 2.98__tar.gz
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-2.91/DOCUMENTATION.md → tiktokautouploader-2.98/Documentation.md +23 -14
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/PKG-INFO +19 -14
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/README.md +18 -13
- tiktokautouploader-2.98/READMEimage/READMEvid.gif +0 -0
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/pyproject.toml +2 -2
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/tiktokautouploader/function.py +118 -71
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/.gitignore +0 -0
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/LICENSE.md +0 -0
- /tiktokautouploader-2.91/READMEimage/Captcha2.gif → /tiktokautouploader-2.98/READMEimage/2ndCaptcha.gif +0 -0
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/READMEimage/Captcha1.gif +0 -0
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/READMEimage/READMEimg.png +0 -0
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/tiktokautouploader/Js_assets/login.js +0 -0
- {tiktokautouploader-2.91 → tiktokautouploader-2.98}/tiktokautouploader/__init__.py +0 -0
@@ -7,7 +7,7 @@ This document provides detailed information about the parameters and usage of th
|
|
7
7
|
- **Parameter Explanations**: Provides detailed descriptions of each parameter, including the valid options and their effects.
|
8
8
|
- **Initialization Info**: Details instances that occur during first run of function
|
9
9
|
- **Important Notes**: Highlights important account recommendations and limitations related to TikTok accounts and scheduling.
|
10
|
-
- **Supported Captchas**: Showcases the
|
10
|
+
- **Supported Captchas**: Showcases the Captchas the code is able to solve
|
11
11
|
- **Runtime**: Provides an estimate of how much runtime is added by different parameters
|
12
12
|
- **Example Usage**: Demonstrates a practical example of how to use the function.
|
13
13
|
|
@@ -38,7 +38,7 @@ This document provides detailed information about the parameters and usage of th
|
|
38
38
|
- **`schedule`** (str, optional, default: None)
|
39
39
|
- The time you want the video to be uploaded. The format should be `HH:MM`, and the minute (`MM`) must be a multiple of 5. The scheduled time must be at least 15 minutes later than the current local time (unless scheduling for a different day). The time should be in your local time zone.
|
40
40
|
|
41
|
-
- **`day`** (int, optional, default: None) (requires
|
41
|
+
- **`day`** (int, optional, default: None) (requires `schedule` != None)
|
42
42
|
- If you want to schedule the video for a different day, this parameter specifies the day of the current month on which to upload the video. i.e: If current day is Sept 3rd, day=5 will upload video on Sept 5th
|
43
43
|
- NOTE: You will also need to specify time of upload in `schedule` parameter or else `day` won't work
|
44
44
|
|
@@ -47,13 +47,13 @@ This document provides detailed information about the parameters and usage of th
|
|
47
47
|
- If scheduling for the next month, you can only schedule within the first 5 days of the next month (as long as they are also within 10 days of the current date). i.e: If current day is Sept 30th, day=5 will upload on Oct 5th, 6 WILL NOT WORK.
|
48
48
|
|
49
49
|
- **`copyrightcheck`** (bool, optional, default: `False`)
|
50
|
-
- If set to `True`, the function will conduct a copyright check on TikTok before uploading. If the check fails, the
|
50
|
+
- If set to `True`, the function will conduct a copyright check on TikTok before uploading. If the check fails, the code execution will stop.
|
51
51
|
|
52
|
-
- **`suppressprint`** (bool, optional, default: `
|
52
|
+
- **`suppressprint`** (bool, optional, default: `False`)
|
53
53
|
- Suppresses print messages that indicate the progress of the video upload. It is recommended to set this to `False` when first running the code to see progress and ensure everything works correctly.
|
54
54
|
|
55
55
|
|
56
|
-
|
56
|
+
## 🛠️ Initialization Info
|
57
57
|
|
58
58
|
- **During FIRST RUN:**
|
59
59
|
|
@@ -64,11 +64,11 @@ This document provides detailed information about the parameters and usage of th
|
|
64
64
|
- Runtime might be a 20-30 seconds longer than usual, this is due to libraries being built. Runtime should return to normal after first run
|
65
65
|
|
66
66
|
|
67
|
-
|
67
|
+
## 📝 Important Notes
|
68
68
|
|
69
69
|
- **VERY IMPORTANT: TikTok Account Recommendations**:
|
70
70
|
- It is recommended to have a TikTok account with at least a few weeks of history built up for the best results.
|
71
|
-
- If you want to upload your video with TikTok sounds, your TikTok account MUST have the ability to save drafts; otherwise, you can just upload/schedule the video with copyright checks and trending hashtags
|
71
|
+
- If you want to upload your video with TikTok sounds, your TikTok account MUST have the ability to save drafts; otherwise, you can just upload/schedule the video with copyright checks and trending hashtags.
|
72
72
|
|
73
73
|
- **Scheduling Limitations**:
|
74
74
|
- The function allows scheduling up to 10 days in advance.
|
@@ -76,23 +76,32 @@ This document provides detailed information about the parameters and usage of th
|
|
76
76
|
|
77
77
|
## ⛔ Supported Captchas:
|
78
78
|
|
79
|
-
|
79
|
+
### Captcha solver currently supports Captchas of type:
|
80
80
|
<p align="center">
|
81
|
-
<img src="READMEimage/Captcha1.gif" alt="" width="
|
81
|
+
<img src="READMEimage/Captcha1.gif" alt="" width="250" loop=infinite/>
|
82
82
|
</p>
|
83
83
|
|
84
84
|
<p align="center">
|
85
|
-
<img src="READMEimage/
|
85
|
+
<img src="READMEimage/2ndCaptcha.gif" alt="" width="250" loop=infinite/>
|
86
86
|
</p>
|
87
87
|
|
88
|
+
#### Note:
|
89
|
+
- These GIFs are just to showcase the project's ability to auto-solve captcha's, this entire process will take place 'under the hood', you will not see the captcha being solved.
|
90
|
+
|
91
|
+
- As far as I'm aware these captchas are the only types of captchas that you may encounter when trying to upload TikTok's, if you do encounter a different captcha, I highly encourage you to email me and let me know and I will try to increase the capabilities of this project to include those captcha's as well.
|
92
|
+
|
93
|
+
- To check what captcha shows up when you upload on your account just open this link while logged in to TikTok: https://www.tiktok.com/tiktokstudio/upload?from=upload&lang=en
|
94
|
+
|
88
95
|
## 🕰️ Runtime:
|
89
|
-
**Total runtime depends on how long TikTok takes to upload your video to their servers, however, here are approximations on how much runtime is added by each parameter**
|
96
|
+
**Total runtime depends on your wifi connection and how long TikTok takes to upload your video to their servers, however, here are approximations on how much runtime is added by each parameter**
|
90
97
|
|
91
|
-
- **Captcha's:**
|
92
|
-
- **Adding Sound:**
|
98
|
+
- **Captcha's:** 8 - 15 secs (in RARE cases, it may take longer)
|
99
|
+
- **Adding Sound:** 8 - 12 secs
|
93
100
|
- **Scheduling:** 1 - 3 secs
|
94
101
|
- **Copyright Check:** 2 - 7 secs
|
95
102
|
|
103
|
+
- All in all, runtime shouldn't exceed one minute in most cases.
|
104
|
+
|
96
105
|
- **NOTE:** When running for the FIRST TIME ONLY, it may take an extra 20 - 30 seconds at the beginning for the code to start running as libraries are being built
|
97
106
|
|
98
107
|
|
@@ -116,4 +125,4 @@ upload_tiktok(
|
|
116
125
|
)
|
117
126
|
```
|
118
127
|
|
119
|
-
For more details or if errors persist, please feel free to contact me at haziqmk123@gmail.com or on LinkedIn (on my github profile)
|
128
|
+
For more details or if errors persist, please feel free to contact me at haziqmk123@gmail.com or on LinkedIn (on my github profile)
|
@@ -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,16 +31,17 @@ 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
|
38
38
|
|
39
|
-
- **🔐 Bypass/Auto Solve Captchas:** No
|
40
|
-
- **🎵 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.
|
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,23 +63,24 @@ 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
|
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:
|
69
|
+
|
70
|
+
```bash
|
71
|
+
python -m playwright install
|
72
|
+
```
|
66
73
|
|
67
|
-
|
68
|
-
python -m playwright install chromium
|
69
|
-
```
|
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.
|
70
75
|
|
71
76
|
|
72
77
|
## 📝 Quick-Start
|
73
78
|
|
74
|
-
|
75
|
-
|
76
|
-
NOTE: It is highly recommended you read DOCUMENTATION.md before using the library.
|
77
|
-
|
79
|
+
**NOTE:** It is highly recommended you read DOCUMENTATION.md before using the library.
|
78
80
|
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
81
|
|
82
|
+
## Upload with hashtags
|
83
|
+
|
80
84
|
```python
|
81
85
|
from tiktokautouploader import upload_tiktok
|
82
86
|
|
@@ -116,6 +120,7 @@ upload_tiktok(video=video_path, description=description, hashtags=hashtags, copy
|
|
116
120
|
- **Maximize your reach:** Add popular sounds and effective hashtags that work to boost visibility.
|
117
121
|
- **Stay compliant:** Built-in copyright checks to avoid unforeseen takedowns.
|
118
122
|
- **Convenient scheduling:** Post at the right time, even when you're away.
|
123
|
+
- **Much faster than manually uploading:** Drastically reduce the time you need to upload videos, just click one button and be done much quicker!
|
119
124
|
|
120
125
|
## 🛠 Dependencies
|
121
126
|
|
@@ -131,7 +136,7 @@ These will be automatically installed when you install the package.
|
|
131
136
|
|
132
137
|
## 👤 Author
|
133
138
|
|
134
|
-
Created by **Haziq
|
139
|
+
Created by **Haziq**. Feel free to reach out at [haziqmk123@gmail.com](mailto:haziqmk123@gmail.com)
|
135
140
|
|
136
141
|
## 📄 License
|
137
142
|
|
@@ -9,16 +9,17 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
<p align="center">
|
12
|
-
<img src="READMEimage/
|
12
|
+
<img src="READMEimage/READMEvid.gif" alt="" width="900"/>
|
13
13
|
</p>
|
14
14
|
|
15
15
|
## 🚀 Features
|
16
16
|
|
17
|
-
- **🔐 Bypass/Auto Solve Captchas:** No
|
18
|
-
- **🎵 Use TikTok Sounds:**
|
17
|
+
- **🔐 Bypass/Auto Solve Captchas:** No need to worry about any captchas interrupting the process, they'll be solved!
|
18
|
+
- **🎵 Use TikTok Sounds:** Go viral by seamlessly adding popular TikTok sounds to your videos.
|
19
19
|
- **🗓 Schedule Uploads:** Upload videos at specific times or upto 10 days in advance with our scheduling feature.
|
20
20
|
- **🔍 Copyright Check:** Ensure your video is safe from copyright claims before uploading.
|
21
21
|
- **🏷 Add Working Hashtags:** Increase your reach by adding effective hashtags that actually work.
|
22
|
+
- **⏰ Cutdown on upload time:** Upload to TikTok with way less hassle and much more speed using our library
|
22
23
|
|
23
24
|
|
24
25
|
## 📦 Installation
|
@@ -29,6 +30,8 @@
|
|
29
30
|
pip install tiktokautouploader
|
30
31
|
```
|
31
32
|
|
33
|
+
**NOTE:** IF YOU HAVE INSTALLED BEFORE, PLEASE MAKE SURE YOU HAVE LATEST VERSION INSTALLED OR ELSE YOU MIGHT FACE BUGS
|
34
|
+
|
32
35
|
---
|
33
36
|
|
34
37
|
## ⚙️ Pre-requisites
|
@@ -38,23 +41,24 @@ pip install tiktokautouploader
|
|
38
41
|
- **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.
|
39
42
|
|
40
43
|
|
41
|
-
2. **Browser Binaries:** If you don't have them already, you'll need to install the
|
44
|
+
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.
|
42
45
|
|
43
|
-
|
46
|
+
to do so, just run the following command AFTER installing the package:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
python -m playwright install
|
50
|
+
```
|
44
51
|
|
45
|
-
|
46
|
-
python -m playwright install chromium
|
47
|
-
```
|
52
|
+
**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.
|
48
53
|
|
49
54
|
|
50
55
|
## 📝 Quick-Start
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
NOTE: It is highly recommended you read DOCUMENTATION.md before using the library.
|
55
|
-
|
57
|
+
**NOTE:** It is highly recommended you read DOCUMENTATION.md before using the library.
|
56
58
|
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.
|
57
59
|
|
60
|
+
## Upload with hashtags
|
61
|
+
|
58
62
|
```python
|
59
63
|
from tiktokautouploader import upload_tiktok
|
60
64
|
|
@@ -94,6 +98,7 @@ upload_tiktok(video=video_path, description=description, hashtags=hashtags, copy
|
|
94
98
|
- **Maximize your reach:** Add popular sounds and effective hashtags that work to boost visibility.
|
95
99
|
- **Stay compliant:** Built-in copyright checks to avoid unforeseen takedowns.
|
96
100
|
- **Convenient scheduling:** Post at the right time, even when you're away.
|
101
|
+
- **Much faster than manually uploading:** Drastically reduce the time you need to upload videos, just click one button and be done much quicker!
|
97
102
|
|
98
103
|
## 🛠 Dependencies
|
99
104
|
|
@@ -109,7 +114,7 @@ These will be automatically installed when you install the package.
|
|
109
114
|
|
110
115
|
## 👤 Author
|
111
116
|
|
112
|
-
Created by **Haziq
|
117
|
+
Created by **Haziq**. Feel free to reach out at [haziqmk123@gmail.com](mailto:haziqmk123@gmail.com)
|
113
118
|
|
114
119
|
## 📄 License
|
115
120
|
|
Binary file
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "tiktokautouploader"
|
7
|
-
version = "2.
|
7
|
+
version = "2.98"
|
8
8
|
description = "Upload or schedule videos to TikTok with viral TikTok sounds and hashtags."
|
9
9
|
readme = {file = "README.md", content-type = "text/markdown"}
|
10
10
|
keywords = ["tiktok", "autoupload", "tiktokautoupload"]
|
@@ -36,7 +36,7 @@ tags = ["wheel"]
|
|
36
36
|
|
37
37
|
[tool.hatch.metadata]
|
38
38
|
name = "tiktokautouploader"
|
39
|
-
version = "2.
|
39
|
+
version = "2.98"
|
40
40
|
description = "Upload or schedule videos to TikTok with TikTok sounds and hashtags that work."
|
41
41
|
readme = {file = "README.md", content-type = "text/markdown"}
|
42
42
|
keywords = ["tiktok", "autoupload", "tiktokautoupload"]
|
@@ -9,17 +9,28 @@ from PIL import Image
|
|
9
9
|
import sys
|
10
10
|
import os
|
11
11
|
import warnings
|
12
|
-
warnings.
|
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())
|
@@ -38,6 +49,7 @@ def check_expiry():
|
|
38
49
|
def run_javascript():
|
39
50
|
js_file_path = pkg_resources.resource_filename(__name__, 'Js_assets/login.js')
|
40
51
|
result = subprocess.run(['node', js_file_path], capture_output=True, text=True)
|
52
|
+
return result
|
41
53
|
|
42
54
|
def install_js_dependencies():
|
43
55
|
js_dir = pkg_resources.resource_filename(__name__, 'Js_assets')
|
@@ -46,6 +58,7 @@ def install_js_dependencies():
|
|
46
58
|
if not os.path.exists(node_modules_path):
|
47
59
|
print("JavaScript dependencies not found. Installing...")
|
48
60
|
subprocess.run(['npm', 'install', 'playwright', 'playwright-extra', 'puppeteer-extra-plugin-stealth', '--silent'], cwd=js_dir, check=True)
|
61
|
+
subprocess.run(['npx', 'playwright', 'install', 'chromium'], cwd=js_dir, check=True)
|
49
62
|
else:
|
50
63
|
time.sleep(0.1)
|
51
64
|
|
@@ -86,11 +99,24 @@ def understood_Qs(question):
|
|
86
99
|
'has strings': 'guitar',
|
87
100
|
'oval and inflatable': 'football',
|
88
101
|
'strumming': 'guitar',
|
89
|
-
'bounces
|
102
|
+
'bounces': 'basketball',
|
90
103
|
'musical instrument': 'guitar',
|
91
104
|
'laces': 'football',
|
92
105
|
'bands': 'guitar',
|
93
|
-
'leather': 'football'
|
106
|
+
'leather': 'football',
|
107
|
+
'leaves':'tree',
|
108
|
+
'pages': 'book',
|
109
|
+
'throwing': 'football',
|
110
|
+
'tossed in a spiral': 'football',
|
111
|
+
'spiky crown': 'pineapple',
|
112
|
+
'pigskin': 'football',
|
113
|
+
'photography': 'camera',
|
114
|
+
'lens': 'camera',
|
115
|
+
'grow': 'tree',
|
116
|
+
'captures images': 'camera',
|
117
|
+
'keeps doctors': 'apple',
|
118
|
+
'crown': 'pineapple',
|
119
|
+
'driven': 'car',
|
94
120
|
}
|
95
121
|
|
96
122
|
for key in understood_terms.keys():
|
@@ -116,8 +142,7 @@ def download_image(image_url):
|
|
116
142
|
|
117
143
|
def run_inference_on_image_tougher(image_path, object):
|
118
144
|
|
119
|
-
|
120
|
-
model = inference.get_model("captcha-2-6ehbe/1")
|
145
|
+
model = inference.get_model("captcha-2-6ehbe/2")
|
121
146
|
results = model.infer(image=image_path)
|
122
147
|
|
123
148
|
class_names = []
|
@@ -137,12 +162,9 @@ def run_inference_on_image_tougher(image_path, object):
|
|
137
162
|
if classes == class_to_click:
|
138
163
|
bounding_box.append(bounding_boxes[i])
|
139
164
|
|
140
|
-
if len(bounding_box) == 2:
|
141
|
-
found_proper = True
|
142
165
|
|
143
|
-
found_proper = True
|
144
166
|
|
145
|
-
return bounding_box
|
167
|
+
return bounding_box
|
146
168
|
|
147
169
|
def run_inference_on_image(image_path):
|
148
170
|
|
@@ -201,7 +223,7 @@ def click_on_objects(page, object_coords):
|
|
201
223
|
|
202
224
|
|
203
225
|
|
204
|
-
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):
|
205
227
|
|
206
228
|
"""
|
207
229
|
UPLOADS VIDEO TO TIKTOK
|
@@ -217,28 +239,37 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
217
239
|
suppressprint (bool) -> True means function doesnt print anything to provide updates on progress
|
218
240
|
--------------------------------------------------------------------------------------------------------------------------------------------
|
219
241
|
"""
|
242
|
+
try:
|
243
|
+
check_for_updates()
|
244
|
+
except:
|
245
|
+
time.sleep(0.1)
|
220
246
|
|
221
247
|
retries = 0
|
222
248
|
cookie_read = False
|
223
|
-
|
249
|
+
oldQ = 'N.A'
|
250
|
+
|
251
|
+
if accountname == None:
|
252
|
+
sys.exit("PLEASE ENTER NAME OF ACCOUNT TO POST ON, READ DOCUMENTATION FOR MORE INFO")
|
224
253
|
|
225
|
-
if os.path.exists('
|
226
|
-
cookies, cookie_read = read_cookies(cookies_path='
|
227
|
-
expired = check_expiry()
|
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)
|
228
257
|
if expired == True:
|
229
|
-
os.remove('
|
230
|
-
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")
|
231
260
|
cookie_read = False
|
232
261
|
|
233
262
|
if cookie_read == False:
|
234
|
-
|
235
|
-
|
263
|
+
install_js_dependencies()
|
264
|
+
login_warning(accountname=accountname)
|
265
|
+
result = run_javascript()
|
266
|
+
os.rename('TK_cookies.json', f'TK_cookies_{accountname}.json')
|
236
267
|
|
237
|
-
cookies, cookie_read = read_cookies("
|
268
|
+
cookies, cookie_read = read_cookies(f"TK_cookies_{accountname}.json")
|
238
269
|
if cookie_read == False:
|
239
270
|
sys.exit("ERROR READING COOKIES")
|
240
271
|
|
241
|
-
|
272
|
+
|
242
273
|
with sync_playwright() as p:
|
243
274
|
|
244
275
|
browser = p.firefox.launch(headless=True)
|
@@ -247,7 +278,9 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
247
278
|
context.add_cookies(cookies)
|
248
279
|
page = context.new_page()
|
249
280
|
url = 'https://www.tiktok.com/tiktokstudio/upload?from=upload&lang=en'
|
250
|
-
|
281
|
+
|
282
|
+
if suppressprint == False:
|
283
|
+
print(f"Uploading to account '{accountname}'")
|
251
284
|
|
252
285
|
while retries < 2:
|
253
286
|
try:
|
@@ -279,24 +312,28 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
279
312
|
print("CAPTCHA DETECTED, Attempting to solve")
|
280
313
|
solved = False
|
281
314
|
attempts = 0
|
315
|
+
question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
|
282
316
|
while solved == False:
|
283
317
|
attempts += 1
|
284
|
-
|
285
|
-
|
318
|
+
start_time = time.time()
|
319
|
+
while question == oldQ:
|
320
|
+
question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
|
321
|
+
if time.time() - start_time > 2:
|
322
|
+
break
|
323
|
+
if 'Select 2 objects that are the same' in question or 'Select two objects that are the same' in question:
|
286
324
|
found = False
|
287
325
|
while found == False:
|
288
326
|
page.click('span.secsdk_captcha_refresh--text')
|
289
|
-
time.sleep(0.5)
|
290
327
|
image = get_image_src(page)
|
291
328
|
img_path = download_image(image)
|
292
329
|
b_box, found = run_inference_on_image(image_path=img_path)
|
293
330
|
|
294
331
|
with Image.open(img_path) as img:
|
295
332
|
image_size = img.size
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
box =
|
333
|
+
|
334
|
+
imageweb = page.locator('#captcha-verify-image')
|
335
|
+
imageweb.wait_for()
|
336
|
+
box = imageweb.bounding_box()
|
300
337
|
image_x = box['x']
|
301
338
|
image_y = box['y']
|
302
339
|
image_height_web = box['height']
|
@@ -304,40 +341,47 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
304
341
|
image_width_real, image_height_real = image_size
|
305
342
|
|
306
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))
|
307
346
|
click_on_objects(page, webpage_coords)
|
347
|
+
page.click("div.verify-captcha-submit-button")
|
308
348
|
time.sleep(0.5)
|
309
349
|
if attempts > 5:
|
310
350
|
sys.exit("FAILED TO SOLVE CAPTCHA")
|
311
|
-
|
312
|
-
page.
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
351
|
+
while showedup == False:
|
352
|
+
if page.locator("div.captcha_verify_message.captcha_verify_message-pass").is_visible():
|
353
|
+
solved = True
|
354
|
+
showedup = True
|
355
|
+
os.remove('captcha_image.jpg')
|
356
|
+
if page.locator("div.captcha_verify_message.captcha_verify_message-fail").is_visible():
|
357
|
+
showedup = True
|
358
|
+
oldQ = question
|
359
|
+
page.click('span.secsdk_captcha_refresh--text')
|
319
360
|
else:
|
320
|
-
|
321
|
-
while
|
361
|
+
objectclick = understood_Qs(question)
|
362
|
+
while objectclick == 'N.A':
|
363
|
+
oldQ = question
|
322
364
|
page.click('span.secsdk_captcha_refresh--text')
|
323
|
-
time.
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
page.click('span.secsdk_captcha_refresh--text')
|
328
|
-
page.wait_for_selector('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT')
|
365
|
+
start_time = time.time()
|
366
|
+
runs = 0
|
367
|
+
while question == oldQ:
|
368
|
+
runs += 1
|
329
369
|
question = page.locator('div.VerifyBar___StyledDiv-sc-12zaxoy-0.hRJhHT').text_content()
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
370
|
+
if runs > 1:
|
371
|
+
time.sleep(1)
|
372
|
+
if time.time() - start_time > 2:
|
373
|
+
break
|
374
|
+
objectclick = understood_Qs(question)
|
375
|
+
image = get_image_src(page)
|
376
|
+
img_path = download_image(image)
|
377
|
+
b_box = run_inference_on_image_tougher(image_path=img_path, object=objectclick)
|
378
|
+
|
335
379
|
with Image.open(img_path) as img:
|
336
380
|
image_size = img.size
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
box =
|
381
|
+
|
382
|
+
imageweb = page.locator('#captcha-verify-image')
|
383
|
+
imageweb.wait_for()
|
384
|
+
box = imageweb.bounding_box()
|
341
385
|
image_x = box['x']
|
342
386
|
image_y = box['y']
|
343
387
|
image_height_web = box['height']
|
@@ -345,21 +389,25 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
345
389
|
image_width_real, image_height_real = image_size
|
346
390
|
|
347
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)
|
348
|
-
|
349
|
-
|
392
|
+
if not webpage_coords:
|
393
|
+
webpage_coords.append((image_x + 50, image_y + 50))
|
350
394
|
click_on_objects(page, webpage_coords)
|
351
|
-
time.sleep(0.5)
|
352
395
|
page.click("div.verify-captcha-submit-button")
|
353
|
-
|
396
|
+
time.sleep(1)
|
397
|
+
if attempts > 20:
|
354
398
|
sys.exit("FAILED TO SOLVE CAPTCHA")
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
399
|
+
showedup = False
|
400
|
+
while showedup == False:
|
401
|
+
if page.locator("div.captcha_verify_message.captcha_verify_message-pass").is_visible():
|
402
|
+
solved = True
|
403
|
+
showedup = True
|
404
|
+
os.remove('captcha_image.jpg')
|
405
|
+
if suppressprint == False:
|
406
|
+
print("CAPTCHA SOLVED")
|
407
|
+
if page.locator("div.captcha_verify_message.captcha_verify_message-fail").is_visible():
|
408
|
+
showedup = True
|
409
|
+
oldQ = question
|
410
|
+
page.click('span.secsdk_captcha_refresh--text')
|
363
411
|
|
364
412
|
|
365
413
|
try:
|
@@ -418,7 +466,7 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
418
466
|
time.sleep(0.2)
|
419
467
|
if suppressprint == False:
|
420
468
|
print("Tik tok done loading file onto servers")
|
421
|
-
|
469
|
+
|
422
470
|
if schedule != None:
|
423
471
|
try:
|
424
472
|
hour = schedule[0:2]
|
@@ -465,7 +513,6 @@ def upload_tiktok(video, description, hashtags=None, sound_name=None, sound_aud_
|
|
465
513
|
if (schedule == None) and (day != None):
|
466
514
|
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
515
|
|
468
|
-
|
469
516
|
if(sound_name == None):
|
470
517
|
if copyrightcheck == True:
|
471
518
|
page.locator(".TUXSwitch-input").nth(0).click()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|