untiktok-api 1.0.0

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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.txt +21 -0
  3. package/README.md +80 -0
  4. package/dist/api/comment.d.ts +42 -0
  5. package/dist/api/comment.js +84 -0
  6. package/dist/api/hashtag.d.ts +52 -0
  7. package/dist/api/hashtag.js +118 -0
  8. package/dist/api/playlist.d.ts +53 -0
  9. package/dist/api/playlist.js +112 -0
  10. package/dist/api/search.d.ts +38 -0
  11. package/dist/api/search.js +98 -0
  12. package/dist/api/sound.d.ts +57 -0
  13. package/dist/api/sound.js +133 -0
  14. package/dist/api/trending.d.ts +21 -0
  15. package/dist/api/trending.js +52 -0
  16. package/dist/api/user.d.ts +187 -0
  17. package/dist/api/user.js +498 -0
  18. package/dist/api/video.d.ts +119 -0
  19. package/dist/api/video.js +399 -0
  20. package/dist/exceptions.d.ts +24 -0
  21. package/dist/exceptions.js +61 -0
  22. package/dist/helpers.d.ts +23 -0
  23. package/dist/helpers.js +66 -0
  24. package/dist/index.d.ts +13 -0
  25. package/dist/index.js +35 -0
  26. package/dist/stealth/index.d.ts +70 -0
  27. package/dist/stealth/index.js +128 -0
  28. package/dist/stealth/js/chrome_app.d.ts +1 -0
  29. package/dist/stealth/js/chrome_app.js +27 -0
  30. package/dist/stealth/js/chrome_csi.d.ts +1 -0
  31. package/dist/stealth/js/chrome_csi.js +14 -0
  32. package/dist/stealth/js/chrome_hairline.d.ts +1 -0
  33. package/dist/stealth/js/chrome_hairline.js +16 -0
  34. package/dist/stealth/js/chrome_load_times.d.ts +1 -0
  35. package/dist/stealth/js/chrome_load_times.js +28 -0
  36. package/dist/stealth/js/chrome_runtime_script.d.ts +1 -0
  37. package/dist/stealth/js/chrome_runtime_script.js +84 -0
  38. package/dist/stealth/js/generate_magic_arrays.d.ts +1 -0
  39. package/dist/stealth/js/generate_magic_arrays.js +28 -0
  40. package/dist/stealth/js/iframe_contentWindow.d.ts +1 -0
  41. package/dist/stealth/js/iframe_contentWindow.js +22 -0
  42. package/dist/stealth/js/media_codecs.d.ts +1 -0
  43. package/dist/stealth/js/media_codecs.js +16 -0
  44. package/dist/stealth/js/navigator_hardwareConcurrency.d.ts +1 -0
  45. package/dist/stealth/js/navigator_hardwareConcurrency.js +6 -0
  46. package/dist/stealth/js/navigator_languages.d.ts +1 -0
  47. package/dist/stealth/js/navigator_languages.js +6 -0
  48. package/dist/stealth/js/navigator_permissions.d.ts +1 -0
  49. package/dist/stealth/js/navigator_permissions.js +11 -0
  50. package/dist/stealth/js/navigator_platform.d.ts +1 -0
  51. package/dist/stealth/js/navigator_platform.js +8 -0
  52. package/dist/stealth/js/navigator_plugins_script.d.ts +1 -0
  53. package/dist/stealth/js/navigator_plugins_script.js +37 -0
  54. package/dist/stealth/js/navigator_userAgent_script.d.ts +1 -0
  55. package/dist/stealth/js/navigator_userAgent_script.js +8 -0
  56. package/dist/stealth/js/navigator_vendor_script.d.ts +1 -0
  57. package/dist/stealth/js/navigator_vendor_script.js +6 -0
  58. package/dist/stealth/js/utils_script.d.ts +1 -0
  59. package/dist/stealth/js/utils_script.js +119 -0
  60. package/dist/stealth/js/webgl_vendor_script.d.ts +1 -0
  61. package/dist/stealth/js/webgl_vendor_script.js +16 -0
  62. package/dist/stealth/js/window_outerdimensions.d.ts +1 -0
  63. package/dist/stealth/js/window_outerdimensions.js +9 -0
  64. package/dist/tiktok.d.ts +96 -0
  65. package/dist/tiktok.js +758 -0
  66. package/dist/types.d.ts +58 -0
  67. package/dist/types.js +6 -0
  68. package/package.json +41 -0
@@ -0,0 +1,58 @@
1
+ import type { BrowserContext, Page } from "playwright";
2
+ export interface ProxySettings {
3
+ server: string;
4
+ bypass?: string;
5
+ username?: string;
6
+ password?: string;
7
+ }
8
+ export interface TikTokPlaywrightSession {
9
+ context: BrowserContext;
10
+ page: Page;
11
+ proxy?: ProxySettings | string | null;
12
+ params?: Record<string, string> | null;
13
+ headers?: Record<string, string> | null;
14
+ msToken?: string | null;
15
+ baseUrl: string;
16
+ isValid: boolean;
17
+ }
18
+ export interface CreateSessionsOptions {
19
+ numSessions?: number;
20
+ headless?: boolean;
21
+ msTokens?: string[] | null;
22
+ /** @deprecated Use proxyProvider instead */
23
+ proxies?: (ProxySettings | string)[] | null;
24
+ sleepAfter?: number;
25
+ startingUrl?: string;
26
+ contextOptions?: Record<string, unknown>;
27
+ overrideBrowserArgs?: string[] | null;
28
+ cookies?: Record<string, string>[] | null;
29
+ suppressResourceLoadTypes?: string[] | null;
30
+ browser?: "chromium" | "firefox" | "webkit";
31
+ executablePath?: string | null;
32
+ pageFactory?: ((context: BrowserContext) => Promise<Page>) | null;
33
+ browserContextFactory?: ((playwright: unknown) => Promise<BrowserContext>) | null;
34
+ timeout?: number;
35
+ enableSessionRecovery?: boolean;
36
+ allowPartialSessions?: boolean;
37
+ minSessions?: number | null;
38
+ }
39
+ export type TikTokResponse = Record<string, unknown>;
40
+ export interface ResourceStats {
41
+ totalSessions: number;
42
+ validSessions: number;
43
+ invalidSessions: number;
44
+ hasBrowser: boolean;
45
+ hasPlaywright: boolean;
46
+ cleanupCalled: boolean;
47
+ autoCleanupEnabled: boolean;
48
+ recoveryEnabled: boolean;
49
+ }
50
+ export interface HealthCheckResult extends ResourceStats {
51
+ sessionDetails: Array<{
52
+ index: number;
53
+ valid: boolean;
54
+ markedValid: boolean;
55
+ }>;
56
+ healthySessions: number;
57
+ warning?: string;
58
+ }
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // ============================================================
3
+ // types.ts
4
+ // Shared TypeScript interfaces and types
5
+ // ============================================================
6
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "untiktok-api",
3
+ "version": "1.0.0",
4
+ "description": "Unofficial TikTok API wrapper in TypeScript (ported from Python)",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "dev": "ts-node src/index.ts",
10
+ "typecheck": "tsc --noEmit",
11
+ "lint": "eslint src",
12
+ "clean": "rimraf dist",
13
+ "prepublishOnly": "npm run clean && npm run build"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "keywords": [
19
+ "tiktok",
20
+ "api",
21
+ "scraper",
22
+ "typescript",
23
+ "playwright"
24
+ ],
25
+ "author": "",
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "axios": "^1.17.0",
29
+ "https-proxy-agent": "^9.1.0",
30
+ "playwright": "^1.44.0"
31
+ },
32
+ "devDependencies": {
33
+ "@eslint/js": "^10.0.1",
34
+ "@types/node": "^25.9.3",
35
+ "eslint": "^10.5.0",
36
+ "rimraf": "^6.1.3",
37
+ "ts-node": "^10.9.2",
38
+ "typescript": "^6.0.3",
39
+ "typescript-eslint": "^8.61.0"
40
+ }
41
+ }