tikforge 0.0.2__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.
tikforge-0.0.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tikforge-api
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.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: tikforge
3
+ Version: 0.0.2
4
+ Summary: TikForge: TikTok API and automation toolkit
5
+ Author-email: TikForge <hdo.tikto@gmail.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ <<<<<<< HEAD
16
+ # tikforge
17
+ TikForge is a Python library for building and managing TikTok-related APIs and automation tools.
18
+ =======
19
+ # TikForge
20
+
21
+ TikForge is a Python library for building and managing TikTok-related APIs and automation tools.
22
+
23
+ ## Installation
24
+ `bash
25
+ pip install tikforge
26
+ >>>>>>> b16af0e (Initial release of TikForge)
@@ -0,0 +1,12 @@
1
+ <<<<<<< HEAD
2
+ # tikforge
3
+ TikForge is a Python library for building and managing TikTok-related APIs and automation tools.
4
+ =======
5
+ # TikForge
6
+
7
+ TikForge is a Python library for building and managing TikTok-related APIs and automation tools.
8
+
9
+ ## Installation
10
+ `bash
11
+ pip install tikforge
12
+ >>>>>>> b16af0e (Initial release of TikForge)
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tikforge"
7
+ version = "0.0.2"
8
+ description = "TikForge: TikTok API and automation toolkit"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+
13
+ authors = [
14
+ { name = "TikForge", email = "hdo.tikto@gmail.com" }
15
+ ]
16
+
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent"
21
+ ]
22
+
23
+ [tool.setuptools]
24
+ packages = ["tikforge"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,390 @@
1
+ #by hdo
2
+ import requests
3
+ import uuid
4
+ import time
5
+ import random
6
+ import base64
7
+ import hashlib
8
+ import secrets
9
+ from random import choice,randint,randrange
10
+ import string,json
11
+ import re
12
+ from os import urandom
13
+ import binascii
14
+ from urllib.parse import urlencode
15
+ from hsopyt import Argus, Ladon, Gorgon, md5
16
+ import datetime
17
+
18
+ class GMAIL:
19
+ @staticmethod
20
+ def CheckEmail(email):
21
+ if '@' in email:
22
+ email = email.split('@')[0]
23
+ if '..' in email or '_' in email or len(email) < 5 or len(email) > 30:
24
+ return False
25
+
26
+ try:
27
+ name = ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for i in range(random.randrange(5,10)))
28
+ birthday = random.randrange(1980,2010),random.randrange(1,12),random.randrange(1,28)
29
+ s = requests.Session()
30
+
31
+ headers = {
32
+ 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
33
+ 'accept-language': 'en-US,en;q=0.9',
34
+ 'referer': 'https://accounts.google.com/',
35
+ 'upgrade-insecure-requests': '1',
36
+ 'user-agent': 'Mozilla/5.0 (Linux; Android 13; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36',
37
+ 'x-browser-channel': 'stable',
38
+ 'x-browser-copyright': 'Copyright 2024 Google LLC. All rights reserved.',
39
+ 'x-browser-year': '2024',
40
+ }
41
+
42
+ params = {
43
+ 'biz': 'false',
44
+ 'continue': 'https://mail.google.com/mail/u/0/',
45
+ 'ddm': '1',
46
+ 'emr': '1',
47
+ 'flowEntry': 'SignUp',
48
+ 'flowName': 'GlifWebSignIn',
49
+ 'followup': 'https://mail.google.com/mail/u/0/',
50
+ 'osid': '1',
51
+ 'service': 'mail',
52
+ }
53
+
54
+ response = s.get('https://accounts.google.com/lifecycle/flows/signup', params=params, headers=headers)
55
+ tl=response.url.split('TL=')[1]
56
+ s1= response.text.split('"Qzxixc":"')[1].split('"')[0]
57
+ at = response.text.split('"SNlM0e":"')[1].split('"')[0]
58
+ headers = {
59
+ 'accept': '*/*',
60
+ 'accept-language': 'en-US,en;q=0.9',
61
+ 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
62
+ 'origin': 'https://accounts.google.com',
63
+ 'referer': 'https://accounts.google.com/',
64
+ 'user-agent': 'Mozilla/5.0 (Linux; Android 13; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36',
65
+ 'x-goog-ext-278367001-jspb': '["GlifWebSignIn"]',
66
+ 'x-goog-ext-391502476-jspb': '["'+s1+'"]',
67
+ 'x-same-domain': '1',
68
+ }
69
+
70
+ params = {
71
+ 'rpcids': 'E815hb',
72
+ 'source-path': '/lifecycle/steps/signup/name',
73
+ 'hl': 'en-US',
74
+ 'TL': tl,
75
+ 'rt': 'c',
76
+ }
77
+
78
+ data = 'f.req=%5B%5B%5B%22E815hb%22%2C%22%5B%5C%22{}%5C%22%2C%5C%22%5C%22%2Cnull%2Cnull%2Cnull%2C%5B%5D%2C%5B%5C%22https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F%5C%22%2C%5C%22mail%5C%22%5D%2C1%5D%22%2Cnull%2C%22generic%22%5D%5D%5D&at={}&'.format(name,at)
79
+
80
+ response = s.post(
81
+ 'https://accounts.google.com/lifecycle/_/AccountLifecyclePlatformSignupUi/data/batchexecute',
82
+ params=params,
83
+ headers=headers,
84
+ data=data,
85
+ ).text
86
+
87
+ headers = {
88
+ 'accept': '*/*',
89
+ 'accept-language': 'en-US,en;q=0.9',
90
+ 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
91
+ 'origin': 'https://accounts.google.com',
92
+ 'referer': 'https://accounts.google.com/',
93
+ 'user-agent': 'Mozilla/5.0 (Linux; Android 13; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36',
94
+ 'x-goog-ext-278367001-jspb': '["GlifWebSignIn"]',
95
+ 'x-goog-ext-391502476-jspb': '["'+s1+'"]',
96
+ 'x-same-domain': '1',
97
+ }
98
+
99
+ params = {
100
+ 'rpcids': 'eOY7Bb',
101
+ 'source-path': '/lifecycle/steps/signup/birthdaygender',
102
+ 'hl': 'en-US',
103
+ 'TL': tl,
104
+ 'rt': 'c',
105
+ }
106
+
107
+ data = 'f.req=%5B%5B%5B%22eOY7Bb%22%2C%22%5B%5B{}%2C{}%2C{}%5D%2C1%2Cnull%2Cnull%2Cnull%2C%5C%22%3Cf7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hWHOly56w9ul4sWzpHqgsqmKynRoaq9SXKrrmbR3f2GKBHSvy3Jm0Ln52zwIQfFSXpOjGXq5pkOXlvQc6MPuV3zADVmcUZs6ywI-ER3PkAaA-f-zG-ke_6jvOzGp6WF8UxnIk5tq3tus_R5pUjVQFjk6qZtWOP8VZd1TeJ54Oo_ywj8YAYCphkDtFYRMZSubmnI-F9LLlAfOiDwQ7r-iNvp8psduy9xrWdIpE_l23Y_qYJPHwvtopL3lB7juqEiFkhUts7NEugyWY-m6-9oEgsOY0lM4746V-XUxSeS7UkZkQZZM19g7GkWjJ61D98i0m2u_UYLnyDFQEaIxVhFcmS1Zq7OMsKm_gYpMt4LuD1F3N__Vj05QNyI59QNQADODveiHpfVva9Cd2AzBm9AKGwU4xDS_FyX3XRsRbfQFtqNzPf1LAERHlnHFn%5C%22%2C%5Bnull%2Cnull%2C%5C%22https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F%5C%22%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5C%22mail%5C%22%5D%5D%22%2Cnull%2C%22generic%22%5D%5D%5D&at={}&'.format(birthday[0],birthday[1],birthday[2],at)
108
+
109
+ response = s.post(
110
+ 'https://accounts.google.com/lifecycle/_/AccountLifecyclePlatformSignupUi/data/batchexecute',
111
+ params=params,
112
+ headers=headers,
113
+ data=data,
114
+ ).text
115
+
116
+ headers = {
117
+ 'accept': '*/*',
118
+ 'accept-language': 'en-US,en;q=0.9',
119
+ 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
120
+ 'origin': 'https://accounts.google.com',
121
+ 'referer': 'https://accounts.google.com/',
122
+ 'user-agent': 'Mozilla/5.0 (Linux; Android 13; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36',
123
+ 'x-goog-ext-278367001-jspb': '["GlifWebSignIn"]',
124
+ 'x-goog-ext-391502476-jspb': '["'+s1+'"]',
125
+ 'x-same-domain': '1',
126
+ }
127
+
128
+ params = {
129
+ 'rpcids': 'NHJMOd',
130
+ 'source-path': '/lifecycle/steps/signup/username',
131
+ 'hl': 'en-US',
132
+ 'TL': tl,
133
+ 'rt': 'c',
134
+ }
135
+
136
+ data = 'f.req=%5B%5B%5B%22NHJMOd%22%2C%22%5B%5C%22{}%5C%22%2C0%2C0%2Cnull%2C%5Bnull%2Cnull%2Cnull%2Cnull%2C1%2C152855%5D%2C0%2C40%5D%22%2Cnull%2C%22generic%22%5D%5D%5D&at={}&'.format(email,at)
137
+
138
+ response = s.post('https://accounts.google.com/lifecycle/_/AccountLifecyclePlatformSignupUi/data/batchexecute',
139
+ params=params,
140
+ headers=headers,
141
+ data=data,
142
+ ).text
143
+
144
+ if "password" in response:
145
+ return {"data":{"status":True,"email":email,"error_code":0,"programmer":"@is71s"}}
146
+ else:
147
+ return {"data":{"status":False,"email":email,"error_code":1,"programmer":"@is71s"}}
148
+
149
+ except Exception as e:
150
+ return {"data":{"status":False,"error":str(e),"programmer":"@is71s"}}
151
+
152
+
153
+ class TIKTOK:
154
+ @staticmethod
155
+ def sign(params: str, payload: str or None = None, sec_device_id: str = '',
156
+ cookie: str or None = None, aid: int = 1233, license_id: int = 1611921764,
157
+ sdk_version_str: str = 'v05.00.06-ov-android', sdk_version: int = 167775296,
158
+ platform: int = 0, unix: float = None):
159
+
160
+ x_ss_stub = md5(payload.encode('utf-8')).hexdigest() if payload != None else None
161
+ if not unix:
162
+ unix = time.time()
163
+
164
+ return Gorgon(params, unix, payload, cookie).get_value() | {
165
+ 'content-length': str(len(payload)),
166
+ 'x-ss-stub': x_ss_stub.upper(),
167
+ 'x-ladon': Ladon.encrypt(int(unix), license_id, aid),
168
+ 'x-argus': Argus.get_sign(
169
+ params, x_ss_stub, int(unix),
170
+ platform=platform,
171
+ aid=aid,
172
+ license_id=license_id,
173
+ sec_device_id=sec_device_id,
174
+ sdk_version=sdk_version_str,
175
+ sdk_version_int=sdk_version
176
+ )
177
+ }
178
+
179
+
180
+
181
+
182
+
183
+ import random
184
+ import requests
185
+
186
+ DEVICES_URL = "https://raw.githubusercontent.com/tikforge-api/tikforge/refs/heads/main/tikforge/devices.txt"
187
+
188
+ def load_device():
189
+ try:
190
+ r = requests.get(DEVICES_URL, timeout=10)
191
+ r.raise_for_status()
192
+ devices = r.text.strip().splitlines()
193
+ except Exception as e:
194
+ raise RuntimeError(f"Failed to load devices list: {e}")
195
+
196
+ if not devices:
197
+ raise RuntimeError("Devices list is empty")
198
+
199
+ devicee = random.choice(devices)
200
+ parts = devicee.split(":")
201
+
202
+ if len(parts) < 6:
203
+ raise ValueError("Invalid device format")
204
+
205
+ iid = parts[0]
206
+ did = parts[1]
207
+ device_type = parts[2]
208
+ device_brand = parts[3]
209
+ openudid = parts[4]
210
+ cdid = parts[5]
211
+
212
+ os_version = f"{random.randint(7, 13)}.{random.randint(0, 5)}"
213
+
214
+ return iid, did, device_type, device_brand, os_version, openudid, cdid
215
+
216
+
217
+
218
+ def CheckTikTok(email, sessionid):
219
+ iid, did, device_type, device_brand, os_version, openudid, cdid = load_device()
220
+ url = "https://api22-normal-c-alisg.tiktokv.com/passport/email/bind_with_email/"
221
+
222
+ params = {
223
+ "passport-sdk-version": "19",
224
+ "iid": iid,
225
+ "device_id": did,
226
+ "ac": "mobile",
227
+ "ac2": "mobile",
228
+ "channel": "googleplay",
229
+ "aid": "1233",
230
+ "app_name": "musical_ly",
231
+ "version_code": "310503",
232
+ "version_name": "31.5.3",
233
+ "ab_version": "31.5.3",
234
+ "build_number": "31.5.3",
235
+ "app_version": "31.5.3",
236
+ "manifest_version_code": "2023105030",
237
+ "update_version_code": "2023105030",
238
+ "device_platform": "android",
239
+ "os": "android",
240
+ "os_api": "28",
241
+ "os_version": "9",
242
+ "device_type": device_type,
243
+ "device_brand": device_brand,
244
+ "host_abi": "arm64-v8a",
245
+ "resolution": "900*1600",
246
+ "dpi": "240",
247
+ "openudid": openudid,
248
+ "language": "en",
249
+ "app_language": "en",
250
+ "locale": "en-GB",
251
+ "content_language": "en,",
252
+ "region": "GB",
253
+ "sys_region": "US",
254
+ "current_region": "TW",
255
+ "op_region": "TW",
256
+ "carrier_region": "TW",
257
+ "carrier_region_v2": "466",
258
+ "residence": "TW",
259
+ "mcc_mnc": "46692",
260
+ "timezone_name": "Asia/Baghdad",
261
+ "timezone_offset": "10800",
262
+ "_rticket": int(time.time() * 1000),
263
+ "ts": int(time.time()),
264
+ "app_type": "normal",
265
+ "is_pad": "0",
266
+ "uoo": "0",
267
+ "support_webview": "1",
268
+ "cronet_version": "2fdb62f9_2023-09-06",
269
+ "ttnet_version": "4.2.152.11-tiktok",
270
+ "use_store_region_cookie": "1",
271
+ "cdid": cdid,
272
+ }
273
+
274
+ payload = {
275
+ 'account_sdk_source': 'app',
276
+ 'multi_login': '1',
277
+ 'email_source': '9',
278
+ 'email': email,
279
+ 'mix_mode': '1'
280
+ }
281
+
282
+ headers = {
283
+ 'user-agent': f'com.zhiliaoapp.musically/310905 (Linux; U; Android {os_version}; en_ma; {device_type}; Build/RP1A.200720.012;tt-ok/3.12.13.4-tiktok)',
284
+ "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
285
+ "cookie": f"sessionid={sessionid}",
286
+ "sdk-version": "2",
287
+ "passport-sdk-version": "19",
288
+ "x-ss-dp": "1233",
289
+ }
290
+
291
+
292
+ sec_device_id = "AadCFwpTyztA5j9L" + ''.join(secrets.choice(string.ascii_letters + string.digits) for _ in range(9))
293
+ headers.update(TIKTOK.sign(urlencode(params), urlencode(payload), sec_device_id, None, 1233))
294
+
295
+ try:
296
+ res = requests.post(url, params=params, data=payload, headers=headers)
297
+ response_json = res.json()
298
+ errur_code = response_json.get('data', {}).get('error_code')
299
+ description = response_json.get('data', {}).get("description")
300
+
301
+ if int(errur_code) == 1023:
302
+ return{"data":{"status":description,"error_code":errur_code,"programmer":"@is71s"}}
303
+ elif int(errur_code) == 1:
304
+ return{"data":{"status":description,"error_code":errur_code,"programmer":"@is71s"}}
305
+ else:
306
+ return{"data":{"status":description,"error_code":errur_code,"programmer":"@is71s"}}
307
+
308
+ except Exception as e:
309
+ return{"data":{"status":"Error {}".format(e),"programmer":"@is71s"}}
310
+
311
+
312
+ class TIKTOK_INFO_V2:
313
+ @staticmethod
314
+ def info(user):
315
+
316
+ try:
317
+ url = f"https://www.tiktok.com/@{user}"
318
+ headers = {
319
+ 'User-Agent': "com.zhiliaoapp.musically/2023605050 (Linux; U; Android 14; ar; SM-S928B; Build/UP1A.231005.007; Cronet/TTNetVersion:1c651b66 2024-08-30 QuicVersion:182d68c8 2024-05-28)",
320
+ 'Accept': "application/json, text/plain, */*",
321
+ 'x-tt-passport-csrf-token': secrets.token_hex(16),
322
+ 'content-type': "application/x-www-form-urlencoded",
323
+ }
324
+
325
+ response = requests.get(url, headers=headers)
326
+ response.raise_for_status()
327
+
328
+ html = response.text
329
+
330
+ m = re.search(r'<script id="__UNIVERSAL_DATA_FOR_REHYDRATION__" type="application/json">(.*?)</script>', html)
331
+ if not m:
332
+ m = re.search(r'({"__DEFAULT_SCOPE__":.*})</script>', html)
333
+
334
+ if not m:
335
+ return {"data": {"status": False, "message": "No user data found", "programmer": "@is71s"}}
336
+
337
+ data = json.loads(m.group(1))
338
+
339
+ try:
340
+ user_data = data["__DEFAULT_SCOPE__"]["webapp.user-detail"]["userInfo"]
341
+ except KeyError:
342
+ try:
343
+ user_data = data["__DEFAULT_SCOPE__"]["webapp.video-detail"]["userInfo"]
344
+ except KeyError:
345
+ try:
346
+ for key in data.keys():
347
+ if "webapp.user-detail" in str(data[key]):
348
+ user_data = data[key]["webapp.user-detail"]["userInfo"]
349
+ break
350
+ else:
351
+ raise KeyError("User data not found in expected paths")
352
+ except:
353
+ return {"data": {"status": False, "message": "Could not parse user data", "programmer": "@is71s"}}
354
+
355
+ u = user_data["user"]
356
+ st = user_data["stats"]
357
+ region = u.get('region', '')
358
+
359
+ if region:
360
+ flag = ''.join(chr(0x1F1E6 + ord(c) - ord('A')) for c in region.upper())
361
+ else:
362
+ flag = ''
363
+ create_time = u.get("createTime", 0)
364
+ if create_time:
365
+ created_date = datetime.datetime.utcfromtimestamp(create_time).strftime("%Y/%m/%d")
366
+ else:
367
+ created_date = "N/A"
368
+ info = {
369
+ "status": True,
370
+ "username": user,
371
+ "name": u.get("nickname", ""),
372
+ "id": u.get('id', ''),
373
+ "followers": st.get("followerCount", 0),
374
+ "following": st.get("followingCount", 0),
375
+ "likes": st.get("heartCount", 0),
376
+ "videos": st.get("videoCount", 0),
377
+ "created": created_date,
378
+ 'privateAccount': u.get('privateAccount', False),
379
+ "region": region,
380
+ "flag": flag,
381
+ "programmer": "@is71s"
382
+ }
383
+ return {"data": info}
384
+ except requests.RequestException as e:
385
+ return {"data": {"status": False, "message": f"Network error: {str(e)}", "programmer": "@is71s"}}
386
+ except json.JSONDecodeError as e:
387
+ return {"data": {"status": False, "message": f"JSON parsing error: {str(e)}", "programmer": "@is71s"}}
388
+ except Exception as e:
389
+ return {"data": {"status": False, "message": f"Unexpected error: {str(e)}", "programmer": "@is71s"}}
390
+
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: tikforge
3
+ Version: 0.0.2
4
+ Summary: TikForge: TikTok API and automation toolkit
5
+ Author-email: TikForge <hdo.tikto@gmail.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ <<<<<<< HEAD
16
+ # tikforge
17
+ TikForge is a Python library for building and managing TikTok-related APIs and automation tools.
18
+ =======
19
+ # TikForge
20
+
21
+ TikForge is a Python library for building and managing TikTok-related APIs and automation tools.
22
+
23
+ ## Installation
24
+ `bash
25
+ pip install tikforge
26
+ >>>>>>> b16af0e (Initial release of TikForge)
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ tikforge/__init__.py
5
+ tikforge.egg-info/PKG-INFO
6
+ tikforge.egg-info/SOURCES.txt
7
+ tikforge.egg-info/dependency_links.txt
8
+ tikforge.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ tikforge