tiktokautouploader 4.0__py2.py3-none-any.whl → 4.2__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/Js_assets/login.js +28 -4
- tiktokautouploader/function.py +77 -24
- {tiktokautouploader-4.0.dist-info → tiktokautouploader-4.2.dist-info}/METADATA +4 -13
- tiktokautouploader-4.2.dist-info/RECORD +7 -0
- tiktokautouploader-4.0.dist-info/RECORD +0 -8
- tiktokautouploader-4.0.dist-info/licenses/LICENSE.md +0 -21
- {tiktokautouploader-4.0.dist-info → tiktokautouploader-4.2.dist-info}/WHEEL +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
const { chromium } = require('playwright-extra')
|
2
|
-
|
2
|
+
const fs = require('fs');
|
3
3
|
|
4
4
|
const stealth = require('puppeteer-extra-plugin-stealth')()
|
5
5
|
|
@@ -18,8 +18,33 @@ async function checkForRedirect(page) {
|
|
18
18
|
}
|
19
19
|
|
20
20
|
(async () => {
|
21
|
+
const args = process.argv.slice(2);
|
22
|
+
let proxy = null;
|
23
|
+
|
24
|
+
for (let i = 0; i < args.length; i++) {
|
25
|
+
if (args[i] === '--proxy' && args[i + 1]) {
|
26
|
+
try {
|
27
|
+
fs.writeFileSync('proxy_data.txt', args[i+1]);
|
28
|
+
proxy = JSON.parse(args[i + 1]); // Parse the proxy string as JSON
|
29
|
+
} catch (error) {
|
30
|
+
console.error('Failed to parse proxy argument:', error);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
const browserOptions = {
|
36
|
+
headless: false,
|
37
|
+
};
|
38
|
+
|
39
|
+
if (proxy && proxy.server) {
|
40
|
+
browserOptions.proxy = {
|
41
|
+
server: proxy.server,
|
42
|
+
username: proxy.username || undefined,
|
43
|
+
password: proxy.password || undefined,
|
44
|
+
}
|
45
|
+
}
|
21
46
|
let redirected = false;
|
22
|
-
const browser = await chromium.launch(
|
47
|
+
const browser = await chromium.launch(browserOptions);
|
23
48
|
const page = await browser.newPage();
|
24
49
|
await page.goto('https://www.tiktok.com/login');
|
25
50
|
|
@@ -32,9 +57,8 @@ async function checkForRedirect(page) {
|
|
32
57
|
|
33
58
|
sleep(2000)
|
34
59
|
const cookies = await page.context().cookies();
|
35
|
-
const fs = require('fs');
|
36
60
|
fs.writeFileSync('TK_cookies.json', JSON.stringify(cookies, null, 2));
|
37
61
|
|
38
|
-
|
62
|
+
|
39
63
|
await browser.close();
|
40
64
|
})();
|
tiktokautouploader/function.py
CHANGED
@@ -39,6 +39,9 @@ def check_expiry(accountname):
|
|
39
39
|
for cookie in cookies:
|
40
40
|
if cookie['name'] in ['sessionid', 'sid_tt', 'sessionid_ss', 'passport_auth_status']:
|
41
41
|
expiry = cookie.get('expires')
|
42
|
+
# for manually extracted cookies
|
43
|
+
if not expiry:
|
44
|
+
expiry = cookie.get('expirationDate')
|
42
45
|
cookies_expire.append(expiry < current_time)
|
43
46
|
|
44
47
|
if all(cookies_expire):
|
@@ -46,9 +49,18 @@ def check_expiry(accountname):
|
|
46
49
|
|
47
50
|
return expired
|
48
51
|
|
49
|
-
def run_javascript():
|
52
|
+
def run_javascript(proxy_data=None):
|
53
|
+
env_vars = {"PROXY": str(proxy_data) if proxy_data is not None else ""}
|
50
54
|
js_file_path = pkg_resources.resource_filename(__name__, 'Js_assets/login.js')
|
51
|
-
|
55
|
+
proxy_argument = str(proxy_data) if proxy_data is not None else str({})
|
56
|
+
try:
|
57
|
+
result = subprocess.run(
|
58
|
+
['node', js_file_path, '--proxy', proxy_argument],
|
59
|
+
capture_output=True,
|
60
|
+
text=True,
|
61
|
+
)
|
62
|
+
except Exception as e:
|
63
|
+
sys.exit(f"Error while running the JavaScript file, when trying to parse cookies: {e}")
|
52
64
|
return result
|
53
65
|
|
54
66
|
def install_js_dependencies():
|
@@ -59,9 +71,16 @@ def install_js_dependencies():
|
|
59
71
|
print("JavaScript dependencies not found. Installing...")
|
60
72
|
try:
|
61
73
|
subprocess.run(['npm', 'install', '--silent'], cwd=js_dir, check=True)
|
62
|
-
except
|
74
|
+
except Exception as e:
|
63
75
|
print("An error occurred during npm installation.")
|
64
76
|
print(f"Error details: {e}")
|
77
|
+
|
78
|
+
print("Trying to install JavaScript dependencies with shell...")
|
79
|
+
try:
|
80
|
+
subprocess.run(['npm', 'install', '--silent'], cwd=js_dir, check=True, shell=True)
|
81
|
+
except Exception as e:
|
82
|
+
print("An error occurred during shell npm installation.")
|
83
|
+
print(f"Error details: {e}")
|
65
84
|
else:
|
66
85
|
time.sleep(0.1)
|
67
86
|
|
@@ -144,9 +163,9 @@ def download_image(image_url):
|
|
144
163
|
|
145
164
|
def run_inference_on_image_tougher(image_path, object):
|
146
165
|
|
147
|
-
|
148
|
-
rk = ''
|
149
|
-
|
166
|
+
#rk <- Roboflow key
|
167
|
+
rk = 'kyHFbAWkOWfGz8fSEw8O'
|
168
|
+
|
150
169
|
CLIENT = InferenceHTTPClient(
|
151
170
|
api_url="https://detect.roboflow.com",
|
152
171
|
api_key=f"{rk}"
|
@@ -177,9 +196,8 @@ def run_inference_on_image_tougher(image_path, object):
|
|
177
196
|
|
178
197
|
def run_inference_on_image(image_path):
|
179
198
|
|
180
|
-
|
181
|
-
rk = ''
|
182
|
-
|
199
|
+
#rk <- Roboflow key
|
200
|
+
rk = 'kyHFbAWkOWfGz8fSEw8O'
|
183
201
|
CLIENT = InferenceHTTPClient(
|
184
202
|
api_url="https://detect.roboflow.com",
|
185
203
|
api_key=f"{rk}"
|
@@ -236,9 +254,37 @@ def click_on_objects(page, object_coords):
|
|
236
254
|
page.mouse.click(x, y)
|
237
255
|
time.sleep(0.5)
|
238
256
|
|
257
|
+
def validate_proxy(proxy):
|
258
|
+
if not proxy:
|
259
|
+
return
|
260
|
+
|
261
|
+
if not isinstance(proxy, dict):
|
262
|
+
raise ValueError("Proxy must be a dictionary.")
|
239
263
|
|
264
|
+
if "server" not in proxy or not isinstance(proxy["server"], str):
|
265
|
+
raise ValueError("Proxy must contain a 'server' key with a string value.")
|
266
|
+
|
267
|
+
try:
|
268
|
+
proxies = {
|
269
|
+
"http": f'http://{proxy["server"]}/',
|
270
|
+
"http": f'https://{proxy["server"]}/',
|
271
|
+
}
|
272
|
+
if proxy.get("username"):
|
273
|
+
proxies = {
|
274
|
+
"http": f'http://{proxy.get("username")}:{proxy.get("password")}@{proxy["server"]}/',
|
275
|
+
"http": f'https://{proxy.get("username")}:{proxy.get("password")}@{proxy["server"]}/',
|
276
|
+
}
|
277
|
+
|
278
|
+
response = requests.get("https://www.google.com", proxies=proxies)
|
279
|
+
if response.status_code == 200:
|
280
|
+
print("Proxy is valid!")
|
281
|
+
else:
|
282
|
+
raise ValueError(f"Proxy test failed with status code: {response.status_code}")
|
283
|
+
except Exception as e:
|
284
|
+
raise ValueError(f"Invalid proxy configuration when trying to simple request: {e}")
|
240
285
|
|
241
|
-
|
286
|
+
|
287
|
+
def upload_tiktok(video, description, accountname, hashtags=None, sound_name=None, sound_aud_vol='mix', schedule=None, day=None, copyrightcheck=False, suppressprint=False, headless=True, stealth=False, proxy=None):
|
242
288
|
|
243
289
|
"""
|
244
290
|
UPLOADS VIDEO TO TIKTOK
|
@@ -246,15 +292,16 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
246
292
|
video (str) -> path to video to upload
|
247
293
|
description (str) -> description for video
|
248
294
|
accountname (str) -> account to upload on
|
249
|
-
hashtags (str)(array) -> hashtags for video
|
250
|
-
sound_name (str) -> name of tik tok sound to use for video
|
251
|
-
sound_aud_vol (str) -> volume of tik tok sound, 'main', 'mix' or 'background', check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
252
|
-
schedule (str) -> format HH:MM, your local time to upload video
|
253
|
-
day (int) -> day to schedule video for, check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
254
|
-
copyrightcheck (bool) -> include copyright check or not; CODE FAILS IF FAIL COPYRIGHT CHECK
|
255
|
-
suppressprint (bool) -> True means function doesnt print anything to provide updates on progress
|
256
|
-
headless (bool) -> run in headless mode or not
|
257
|
-
stealth (bool) -> will wait second(s) before each operation
|
295
|
+
hashtags (str)(array)(opt) -> hashtags for video
|
296
|
+
sound_name (str)(opt) -> name of tik tok sound to use for video
|
297
|
+
sound_aud_vol (str)(opt) -> volume of tik tok sound, 'main', 'mix' or 'background', check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
298
|
+
schedule (str)(opt) -> format HH:MM, your local time to upload video
|
299
|
+
day (int)(opt) -> day to schedule video for, check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
300
|
+
copyrightcheck (bool)(opt) -> include copyright check or not; CODE FAILS IF FAIL COPYRIGHT CHECK
|
301
|
+
suppressprint (bool)(opt) -> True means function doesnt print anything to provide updates on progress
|
302
|
+
headless (bool)(opt) -> run in headless mode or not
|
303
|
+
stealth (bool)(opt) -> will wait second(s) before each operation
|
304
|
+
proxy (dict)(opt) -> proxy server to run code on, check documentation for more info -> https://github.com/haziq-exe/TikTokAutoUploader
|
258
305
|
--------------------------------------------------------------------------------------------------------------------------------------------
|
259
306
|
"""
|
260
307
|
try:
|
@@ -262,6 +309,11 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
262
309
|
except:
|
263
310
|
time.sleep(0.1)
|
264
311
|
|
312
|
+
try:
|
313
|
+
validate_proxy(proxy)
|
314
|
+
except Exception as e:
|
315
|
+
sys.exit(f'Error validating proxy: {e}')
|
316
|
+
|
265
317
|
retries = 0
|
266
318
|
cookie_read = False
|
267
319
|
oldQ = 'N.A'
|
@@ -280,7 +332,7 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
280
332
|
if cookie_read == False:
|
281
333
|
install_js_dependencies()
|
282
334
|
login_warning(accountname=accountname)
|
283
|
-
result = run_javascript()
|
335
|
+
result = run_javascript(proxy_data=proxy)
|
284
336
|
os.rename('TK_cookies.json', f'TK_cookies_{accountname}.json')
|
285
337
|
|
286
338
|
cookies, cookie_read = read_cookies(f"TK_cookies_{accountname}.json")
|
@@ -290,7 +342,7 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
290
342
|
|
291
343
|
with sync_playwright() as p:
|
292
344
|
|
293
|
-
browser = p.firefox.launch(headless=headless)
|
345
|
+
browser = p.firefox.launch(headless=headless, proxy=proxy)
|
294
346
|
context = browser.new_context()
|
295
347
|
context.add_cookies(cookies)
|
296
348
|
page = context.new_page()
|
@@ -471,8 +523,9 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
471
523
|
except:
|
472
524
|
if suppressprint == False:
|
473
525
|
print(f"Tik tok hashtag not working for {hashtag}, moving onto next")
|
474
|
-
|
475
|
-
|
526
|
+
page.keyboard.type(f"{hashtag[-1]} ")
|
527
|
+
# for _ in range(len(hashtag)):
|
528
|
+
# page.keyboard.press("Backspace")
|
476
529
|
|
477
530
|
if suppressprint == False:
|
478
531
|
print("Description and Hashtags added")
|
@@ -696,7 +749,7 @@ def upload_tiktok(video, description, accountname, hashtags=None, sound_name=Non
|
|
696
749
|
time.sleep(0.5)
|
697
750
|
page.close()
|
698
751
|
|
699
|
-
browser = p.chromium.launch(headless=headless)
|
752
|
+
browser = p.chromium.launch(headless=headless, proxy=proxy)
|
700
753
|
|
701
754
|
context = browser.new_context()
|
702
755
|
context.add_cookies(cookies)
|
@@ -1,10 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: tiktokautouploader
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.2
|
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>
|
7
|
-
License-File: LICENSE.md
|
8
7
|
Keywords: autoupload,tiktok,tiktokautoupload
|
9
8
|
Classifier: License :: OSI Approved :: MIT License
|
10
9
|
Classifier: Operating System :: OS Independent
|
@@ -17,6 +16,7 @@ Requires-Dist: inference>=0.18.1
|
|
17
16
|
Requires-Dist: pillow>=8.0.0
|
18
17
|
Requires-Dist: playwright>=1.0.0
|
19
18
|
Requires-Dist: requests>=2.0.0
|
19
|
+
Requires-Dist: scikit-learn>=0.24.0
|
20
20
|
Description-Content-Type: text/markdown
|
21
21
|
|
22
22
|
<div align="center">
|
@@ -41,6 +41,7 @@ Description-Content-Type: text/markdown
|
|
41
41
|
- **🏷 Add Working Hashtags:** Increase your reach by adding effective hashtags that actually work.
|
42
42
|
- **⏰ Cutdown on upload time:** Upload to TikTok with way less hassle and much more speed using our library.
|
43
43
|
- **📝 Upload to different accounts:** Stay organized and on top of multiple different accounts with our multi-account functionality.
|
44
|
+
- **🤖 Upload with Telegram**: Code can be integrated with Telegram Bot (More info in /TelegramAutomation)
|
44
45
|
|
45
46
|
⭐️ If you like this project please feel free to star it, Thank you.
|
46
47
|
|
@@ -71,8 +72,6 @@ pip install tiktokautouploader
|
|
71
72
|
python -m playwright install
|
72
73
|
```
|
73
74
|
|
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
|
-
|
76
75
|
|
77
76
|
## 📝 Quick-Start
|
78
77
|
|
@@ -115,7 +114,7 @@ PLEASE READ DOCUMENTATION FOR MORE INFO
|
|
115
114
|
upload_tiktok(video=video_path, description=description, accountname=accountname, hashtags=hashtags, copyrightcheck=True)
|
116
115
|
```
|
117
116
|
|
118
|
-
## 🎯 Why Choose `
|
117
|
+
## 🎯 Why Choose `tiktokautouploader`?
|
119
118
|
|
120
119
|
- **No more captchas:** Fully automated uploads without interruptions, If captchas do show up, no worries, they will be solved. (read documentation for more info)
|
121
120
|
- **Maximize your reach:** Add popular sounds and effective hashtags that work to boost visibility and go viral!
|
@@ -131,7 +130,6 @@ This library requires the following dependencies:
|
|
131
130
|
- `playwright`
|
132
131
|
- `requests`
|
133
132
|
- `Pillow`
|
134
|
-
- `scikit-learn`
|
135
133
|
- `inference`
|
136
134
|
|
137
135
|
These will be automatically installed when you install the package.
|
@@ -143,10 +141,3 @@ Created by **Haziq**. Feel free to reach out at [haziqmk123@gmail.com](mailto:ha
|
|
143
141
|
## 📄 License
|
144
142
|
|
145
143
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
|
146
|
-
|
147
|
-
## 📮 Related Projects
|
148
|
-
|
149
|
-
If you liked this project please check out my use case showcase project that generates TikToks and uploads them using 'tiktokautouploader'
|
150
|
-
|
151
|
-
[TikTokGenerator](https://github.com/haziq-exe/TikTokGenerator)
|
152
|
-
|
@@ -0,0 +1,7 @@
|
|
1
|
+
tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
|
2
|
+
tiktokautouploader/function.py,sha256=3_FNO_ayvEbuLECqet_VtOzVAsSGgMbkw2z0k_4hfzs,49215
|
3
|
+
tiktokautouploader/Js_assets/login.js,sha256=NOuTNaGteOAhae-D6-WUH7aMKokCC6rO49EOzAo5vjQ,1690
|
4
|
+
tiktokautouploader/Js_assets/package.json,sha256=aNbwSOpEpDUlplSuXugHVeN11riVwV4ofVkRPwHzbLs,273
|
5
|
+
tiktokautouploader-4.2.dist-info/METADATA,sha256=m1lNmgDggM81_k3iBri-h7eAe8w7kogignTvj5ppSMs,5835
|
6
|
+
tiktokautouploader-4.2.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
7
|
+
tiktokautouploader-4.2.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
tiktokautouploader/__init__.py,sha256=u7OWCK_u68ST8dfrkSF4Yw44CJOzV9NXI6ASRuoDfmE,64
|
2
|
-
tiktokautouploader/function.py,sha256=fKS8bm6yzvP9QXO_Y8gAcZufOIhA_G2WsSwM_xH0KmM,46918
|
3
|
-
tiktokautouploader/Js_assets/login.js,sha256=SLhtPYo8ZfTRUnbR7Xqp084lSuAOqIWUxi75FlFH3vs,966
|
4
|
-
tiktokautouploader/Js_assets/package.json,sha256=aNbwSOpEpDUlplSuXugHVeN11riVwV4ofVkRPwHzbLs,273
|
5
|
-
tiktokautouploader-4.0.dist-info/METADATA,sha256=7C6hDX0w_QKgybBMx756B3BqzuVQL1rCeSUP7dsWe9I,6125
|
6
|
-
tiktokautouploader-4.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
7
|
-
tiktokautouploader-4.0.dist-info/licenses/LICENSE.md,sha256=hYds_VJIpnS5gC73WhuWk2IY_e9BWjuEJthQCb9ThyU,1073
|
8
|
-
tiktokautouploader-4.0.dist-info/RECORD,,
|
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) [2024] [HAZIQ KHALID]
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
File without changes
|