tikforge 0.0.2__tar.gz → 0.0.6__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.
@@ -1,15 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tikforge
3
- Version: 0.0.2
4
- Summary: TikForge: TikTok API and automation toolkit
5
- Author-email: TikForge <hdo.tikto@gmail.com>
3
+ Version: 0.0.6
4
+ Summary: TikTok private API utilities
5
+ Author-email: is71s <is71s@users.noreply.github.com>
6
6
  License: MIT
7
+ Project-URL: Homepage, https://github.com/tikforge-api/tikforge
8
+ Project-URL: Source, https://github.com/tikforge-api/tikforge
9
+ Project-URL: Issues, https://github.com/tikforge-api/tikforge/issues
10
+ Keywords: tiktok,api,automation,security
7
11
  Classifier: Programming Language :: Python :: 3
8
12
  Classifier: License :: OSI Approved :: MIT License
9
13
  Classifier: Operating System :: OS Independent
10
14
  Requires-Python: >=3.8
11
15
  Description-Content-Type: text/markdown
12
16
  License-File: LICENSE
17
+ Requires-Dist: requests
18
+ Requires-Dist: user-agent
19
+ Requires-Dist: pycryptodome
13
20
  Dynamic: license-file
14
21
 
15
22
  <<<<<<< HEAD
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tikforge"
7
+ version = "0.0.6"
8
+ description = "TikTok private API utilities"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "is71s", email = "is71s@users.noreply.github.com" }
14
+ ]
15
+
16
+ keywords = ["tiktok", "api", "automation", "security"]
17
+
18
+ dependencies = [
19
+ "requests",
20
+ "user-agent",
21
+ "pycryptodome"
22
+ ]
23
+
24
+ classifiers = [
25
+ "Programming Language :: Python :: 3",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Operating System :: OS Independent"
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/tikforge-api/tikforge"
32
+ Source = "https://github.com/tikforge-api/tikforge"
33
+ Issues = "https://github.com/tikforge-api/tikforge/issues"
34
+
35
+ [tool.setuptools]
36
+ packages = ["tikforge"]
37
+
38
+ [tool.setuptools.package-data]
39
+ tikforge = ["devices.txt"]
@@ -213,11 +213,10 @@ def load_device():
213
213
 
214
214
  return iid, did, device_type, device_brand, os_version, openudid, cdid
215
215
 
216
-
217
-
218
216
  def CheckTikTok(email, sessionid):
219
217
  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/"
218
+
219
+ url = "https://api22-normal-c-alisg.tiktokv.com/passport/email/bind_without_verify/"
221
220
 
222
221
  params = {
223
222
  "passport-sdk-version": "19",
@@ -272,15 +271,15 @@ def CheckTikTok(email, sessionid):
272
271
  }
273
272
 
274
273
  payload = {
275
- 'account_sdk_source': 'app',
276
- 'multi_login': '1',
277
- 'email_source': '9',
278
- 'email': email,
279
- 'mix_mode': '1'
274
+ "account_sdk_source": "app",
275
+ "multi_login": "1",
276
+ "email_source": "9",
277
+ "email": email,
278
+ "mix_mode": "1"
280
279
  }
281
280
 
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)',
281
+ headers = {
282
+ "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
283
  "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
285
284
  "cookie": f"sessionid={sessionid}",
286
285
  "sdk-version": "2",
@@ -288,26 +287,48 @@ def CheckTikTok(email, sessionid):
288
287
  "x-ss-dp": "1233",
289
288
  }
290
289
 
290
+ sec_device_id = "AadCFwpTyztA5j9L" + "".join(
291
+ secrets.choice(string.ascii_letters + string.digits) for _ in range(9)
292
+ )
293
+
294
+ headers.update(
295
+ TIKTOK.sign(urlencode(params), urlencode(payload), sec_device_id, None, 1233)
296
+ )
291
297
 
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
298
  try:
296
- res = requests.post(url, params=params, data=payload, headers=headers)
299
+ res = requests.post(url, params=params, data=payload, headers=headers, timeout=15)
297
300
  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
301
 
302
+ data = response_json.get("data", {})
303
+ errur_code = data.get("error_code")
304
+ description = data.get("description", "No description")
305
+
306
+ if errur_code is None:
307
+ return {
308
+ "data": {
309
+ "status": "Unknown response",
310
+ "raw": response_json,
311
+ "programmer": "@is71s"
312
+ }
313
+ }
314
+
315
+ errur_code = int(errur_code)
316
+
317
+ return {
318
+ "data": {
319
+ "status": description,
320
+ "error_code": errur_code,
321
+ "programmer": "@is71s"
322
+ }
323
+ }
324
+
325
+ except Exception as e:
326
+ return {
327
+ "data": {
328
+ "status": f"Error {e}",
329
+ "programmer": "@is71s"
330
+ }
331
+ }
311
332
 
312
333
  class TIKTOK_INFO_V2:
313
334
  @staticmethod