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.
- package/LICENSE +21 -0
- package/LICENSE.txt +21 -0
- package/README.md +80 -0
- package/dist/api/comment.d.ts +42 -0
- package/dist/api/comment.js +84 -0
- package/dist/api/hashtag.d.ts +52 -0
- package/dist/api/hashtag.js +118 -0
- package/dist/api/playlist.d.ts +53 -0
- package/dist/api/playlist.js +112 -0
- package/dist/api/search.d.ts +38 -0
- package/dist/api/search.js +98 -0
- package/dist/api/sound.d.ts +57 -0
- package/dist/api/sound.js +133 -0
- package/dist/api/trending.d.ts +21 -0
- package/dist/api/trending.js +52 -0
- package/dist/api/user.d.ts +187 -0
- package/dist/api/user.js +498 -0
- package/dist/api/video.d.ts +119 -0
- package/dist/api/video.js +399 -0
- package/dist/exceptions.d.ts +24 -0
- package/dist/exceptions.js +61 -0
- package/dist/helpers.d.ts +23 -0
- package/dist/helpers.js +66 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +35 -0
- package/dist/stealth/index.d.ts +70 -0
- package/dist/stealth/index.js +128 -0
- package/dist/stealth/js/chrome_app.d.ts +1 -0
- package/dist/stealth/js/chrome_app.js +27 -0
- package/dist/stealth/js/chrome_csi.d.ts +1 -0
- package/dist/stealth/js/chrome_csi.js +14 -0
- package/dist/stealth/js/chrome_hairline.d.ts +1 -0
- package/dist/stealth/js/chrome_hairline.js +16 -0
- package/dist/stealth/js/chrome_load_times.d.ts +1 -0
- package/dist/stealth/js/chrome_load_times.js +28 -0
- package/dist/stealth/js/chrome_runtime_script.d.ts +1 -0
- package/dist/stealth/js/chrome_runtime_script.js +84 -0
- package/dist/stealth/js/generate_magic_arrays.d.ts +1 -0
- package/dist/stealth/js/generate_magic_arrays.js +28 -0
- package/dist/stealth/js/iframe_contentWindow.d.ts +1 -0
- package/dist/stealth/js/iframe_contentWindow.js +22 -0
- package/dist/stealth/js/media_codecs.d.ts +1 -0
- package/dist/stealth/js/media_codecs.js +16 -0
- package/dist/stealth/js/navigator_hardwareConcurrency.d.ts +1 -0
- package/dist/stealth/js/navigator_hardwareConcurrency.js +6 -0
- package/dist/stealth/js/navigator_languages.d.ts +1 -0
- package/dist/stealth/js/navigator_languages.js +6 -0
- package/dist/stealth/js/navigator_permissions.d.ts +1 -0
- package/dist/stealth/js/navigator_permissions.js +11 -0
- package/dist/stealth/js/navigator_platform.d.ts +1 -0
- package/dist/stealth/js/navigator_platform.js +8 -0
- package/dist/stealth/js/navigator_plugins_script.d.ts +1 -0
- package/dist/stealth/js/navigator_plugins_script.js +37 -0
- package/dist/stealth/js/navigator_userAgent_script.d.ts +1 -0
- package/dist/stealth/js/navigator_userAgent_script.js +8 -0
- package/dist/stealth/js/navigator_vendor_script.d.ts +1 -0
- package/dist/stealth/js/navigator_vendor_script.js +6 -0
- package/dist/stealth/js/utils_script.d.ts +1 -0
- package/dist/stealth/js/utils_script.js +119 -0
- package/dist/stealth/js/webgl_vendor_script.d.ts +1 -0
- package/dist/stealth/js/webgl_vendor_script.js +16 -0
- package/dist/stealth/js/window_outerdimensions.d.ts +1 -0
- package/dist/stealth/js/window_outerdimensions.js +9 -0
- package/dist/tiktok.d.ts +96 -0
- package/dist/tiktok.js +758 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.js +6 -0
- package/package.json +41 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// api/search.ts
|
|
4
|
+
// Mirrors TikTokApi/api/search.py
|
|
5
|
+
// ============================================================
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Search = void 0;
|
|
8
|
+
const exceptions_1 = require("../exceptions");
|
|
9
|
+
class Search {
|
|
10
|
+
constructor(parent) {
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Searches for users.
|
|
15
|
+
*
|
|
16
|
+
* Note: Your ms_token must have been used for a TikTok search already.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* for await (const user of api.search.users('david teather')) {
|
|
21
|
+
* console.log(user.username);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async *users(searchTerm, count = 10, cursor = 0, kwargs = {}) {
|
|
26
|
+
for await (const user of this.searchType(searchTerm, "user", count, cursor, kwargs)) {
|
|
27
|
+
yield user;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Searches for a specific type of object.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* for await (const user of api.search.searchType('david teather', 'user')) {
|
|
36
|
+
* console.log(user);
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
async *searchType(searchTerm, objType, count = 10, cursor = 0, kwargs = {}) {
|
|
41
|
+
let found = 0;
|
|
42
|
+
let searchId = "";
|
|
43
|
+
while (found < count) {
|
|
44
|
+
const params = {
|
|
45
|
+
keyword: searchTerm,
|
|
46
|
+
cursor,
|
|
47
|
+
from_page: "search",
|
|
48
|
+
web_search_code: JSON.stringify({
|
|
49
|
+
tiktok: {
|
|
50
|
+
client_params_x: {
|
|
51
|
+
search_engine: {
|
|
52
|
+
ies_mt_user_live_video_card_use_libra: 1,
|
|
53
|
+
mt_search_general_user_live_card: 1,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
search_server: {},
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
if (searchId) {
|
|
61
|
+
params["search_id"] = searchId;
|
|
62
|
+
}
|
|
63
|
+
const resp = await this.parent.makeRequest({
|
|
64
|
+
url: `https://www.tiktok.com/api/search/${objType}/full/`,
|
|
65
|
+
params,
|
|
66
|
+
headers: kwargs.headers,
|
|
67
|
+
sessionIndex: kwargs.sessionIndex,
|
|
68
|
+
});
|
|
69
|
+
if (resp == null) {
|
|
70
|
+
throw new exceptions_1.InvalidResponseException(resp, "TikTok returned an invalid response.");
|
|
71
|
+
}
|
|
72
|
+
if (objType === "user") {
|
|
73
|
+
const userList = resp["user_list"] ?? [];
|
|
74
|
+
for (const user of userList) {
|
|
75
|
+
const userInfo = user["user_info"];
|
|
76
|
+
yield this.parent.user({
|
|
77
|
+
secUid: userInfo["sec_uid"],
|
|
78
|
+
userId: userInfo["user_id"],
|
|
79
|
+
username: userInfo["unique_id"],
|
|
80
|
+
});
|
|
81
|
+
found++;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (objType === "item") {
|
|
85
|
+
const itemList = resp["item_list"] ?? [];
|
|
86
|
+
for (const item of itemList) {
|
|
87
|
+
yield this.parent.video({ data: item });
|
|
88
|
+
found++;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!resp["has_more"])
|
|
92
|
+
return;
|
|
93
|
+
cursor = resp["cursor"];
|
|
94
|
+
searchId = resp["rid"] ?? "";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.Search = Search;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { TikTokApi } from "../tiktok";
|
|
2
|
+
import type { User } from "./user";
|
|
3
|
+
import type { Video } from "./video";
|
|
4
|
+
export interface SoundOptions {
|
|
5
|
+
id?: string | null;
|
|
6
|
+
data?: Record<string, unknown> | null;
|
|
7
|
+
}
|
|
8
|
+
export declare class Sound {
|
|
9
|
+
/** Static reference to the parent TikTokApi instance */
|
|
10
|
+
parent: TikTokApi;
|
|
11
|
+
/** TikTok's ID for the sound */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** The title of the song */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** The author of the song */
|
|
16
|
+
author?: User;
|
|
17
|
+
/** Duration in seconds */
|
|
18
|
+
duration?: number;
|
|
19
|
+
/** Whether the song is original */
|
|
20
|
+
original?: boolean;
|
|
21
|
+
/** Play URL */
|
|
22
|
+
playUrl?: string;
|
|
23
|
+
/** Cover URL (large) */
|
|
24
|
+
coverLarge?: string;
|
|
25
|
+
/** The raw data */
|
|
26
|
+
asDict?: Record<string, unknown>;
|
|
27
|
+
constructor(parent: TikTokApi, { id, data }?: SoundOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Returns all information sent by TikTok related to this sound.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const soundInfo = await api.sound({ id: '7016547803243022337' }).info();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
info(kwargs?: {
|
|
37
|
+
msToken?: string;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
sessionIndex?: number;
|
|
40
|
+
}): Promise<Record<string, unknown>>;
|
|
41
|
+
/**
|
|
42
|
+
* Returns videos created with this sound.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* for await (const video of api.sound({ id: '7016547803243022337' }).videos()) {
|
|
47
|
+
* console.log(video.id);
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
videos(count?: number, cursor?: number, kwargs?: {
|
|
52
|
+
headers?: Record<string, string>;
|
|
53
|
+
sessionIndex?: number;
|
|
54
|
+
}): AsyncGenerator<Video>;
|
|
55
|
+
private _extractFromData;
|
|
56
|
+
toString(): string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// api/sound.ts
|
|
4
|
+
// Mirrors TikTokApi/api/sound.py
|
|
5
|
+
// ============================================================
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Sound = void 0;
|
|
8
|
+
const exceptions_1 = require("../exceptions");
|
|
9
|
+
class Sound {
|
|
10
|
+
constructor(parent, { id, data } = {}) {
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
if (data) {
|
|
13
|
+
this.asDict = data;
|
|
14
|
+
this._extractFromData();
|
|
15
|
+
}
|
|
16
|
+
else if (id == null) {
|
|
17
|
+
throw new TypeError("You must provide id parameter.");
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.id = id;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns all information sent by TikTok related to this sound.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const soundInfo = await api.sound({ id: '7016547803243022337' }).info();
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
async info(kwargs = {}) {
|
|
32
|
+
const id = this.id;
|
|
33
|
+
if (!id) {
|
|
34
|
+
throw new TypeError("You must provide the id when creating this class to use this method.");
|
|
35
|
+
}
|
|
36
|
+
const urlParams = {
|
|
37
|
+
msToken: kwargs.msToken,
|
|
38
|
+
musicId: id,
|
|
39
|
+
};
|
|
40
|
+
const resp = await this.parent.makeRequest({
|
|
41
|
+
url: "https://www.tiktok.com/api/music/detail/",
|
|
42
|
+
params: urlParams,
|
|
43
|
+
headers: kwargs.headers,
|
|
44
|
+
sessionIndex: kwargs.sessionIndex,
|
|
45
|
+
});
|
|
46
|
+
if (resp == null) {
|
|
47
|
+
throw new exceptions_1.InvalidResponseException(resp, "TikTok returned an invalid response.");
|
|
48
|
+
}
|
|
49
|
+
this.asDict = resp;
|
|
50
|
+
this._extractFromData();
|
|
51
|
+
return resp;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns videos created with this sound.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* for await (const video of api.sound({ id: '7016547803243022337' }).videos()) {
|
|
59
|
+
* console.log(video.id);
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
async *videos(count = 30, cursor = 0, kwargs = {}) {
|
|
64
|
+
const id = this.id;
|
|
65
|
+
if (!id) {
|
|
66
|
+
throw new TypeError("You must provide the id when creating this class to use this method.");
|
|
67
|
+
}
|
|
68
|
+
let found = 0;
|
|
69
|
+
while (found < count) {
|
|
70
|
+
const params = {
|
|
71
|
+
musicID: id,
|
|
72
|
+
count: 30,
|
|
73
|
+
cursor,
|
|
74
|
+
};
|
|
75
|
+
const resp = await this.parent.makeRequest({
|
|
76
|
+
url: "https://www.tiktok.com/api/music/item_list/",
|
|
77
|
+
params,
|
|
78
|
+
headers: kwargs.headers,
|
|
79
|
+
sessionIndex: kwargs.sessionIndex,
|
|
80
|
+
});
|
|
81
|
+
if (resp == null) {
|
|
82
|
+
throw new exceptions_1.InvalidResponseException(resp, "TikTok returned an invalid response.");
|
|
83
|
+
}
|
|
84
|
+
const itemList = resp["itemList"] ?? [];
|
|
85
|
+
for (const item of itemList) {
|
|
86
|
+
yield this.parent.video({ data: item });
|
|
87
|
+
found++;
|
|
88
|
+
}
|
|
89
|
+
if (!resp["hasMore"])
|
|
90
|
+
return;
|
|
91
|
+
cursor = resp["cursor"];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
_extractFromData() {
|
|
95
|
+
const data = this.asDict ?? {};
|
|
96
|
+
const keys = Object.keys(data);
|
|
97
|
+
if (keys.includes("musicInfo")) {
|
|
98
|
+
const musicInfo = data["musicInfo"];
|
|
99
|
+
const author = musicInfo["author"];
|
|
100
|
+
if (typeof author === "object" && author !== null) {
|
|
101
|
+
this.author = this.parent.user({ data: author });
|
|
102
|
+
}
|
|
103
|
+
else if (typeof author === "string") {
|
|
104
|
+
this.author = this.parent.user({ username: author });
|
|
105
|
+
}
|
|
106
|
+
const music = musicInfo["music"];
|
|
107
|
+
if (music) {
|
|
108
|
+
this.title = music["title"];
|
|
109
|
+
this.id = music["id"];
|
|
110
|
+
this.original = music["original"];
|
|
111
|
+
this.playUrl = music["playUrl"];
|
|
112
|
+
this.coverLarge = music["coverLarge"];
|
|
113
|
+
this.duration = music["duration"];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (keys.includes("music")) {
|
|
117
|
+
const music = data["music"];
|
|
118
|
+
this.title = music["title"];
|
|
119
|
+
this.id = music["id"];
|
|
120
|
+
this.original = music["original"];
|
|
121
|
+
this.playUrl = music["playUrl"];
|
|
122
|
+
this.coverLarge = music["coverLarge"];
|
|
123
|
+
this.duration = music["duration"];
|
|
124
|
+
}
|
|
125
|
+
if (!this.id) {
|
|
126
|
+
this.parent.logger.error(`Failed to create Sound with data: ${JSON.stringify(data)}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
toString() {
|
|
130
|
+
return `TikTokApi.sound(id='${this.id}')`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.Sound = Sound;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TikTokApi } from "../tiktok";
|
|
2
|
+
import type { Video } from "./video";
|
|
3
|
+
export declare class Trending {
|
|
4
|
+
/** Static reference to the parent TikTokApi instance */
|
|
5
|
+
parent: TikTokApi;
|
|
6
|
+
constructor(parent: TikTokApi);
|
|
7
|
+
/**
|
|
8
|
+
* Returns Videos that are trending on TikTok.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* for await (const video of api.trending.videos()) {
|
|
13
|
+
* console.log(video.id);
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
videos(count?: number, kwargs?: {
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
sessionIndex?: number;
|
|
20
|
+
}): AsyncGenerator<Video>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// api/trending.ts
|
|
4
|
+
// Mirrors TikTokApi/api/trending.py
|
|
5
|
+
// ============================================================
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Trending = void 0;
|
|
8
|
+
const exceptions_1 = require("../exceptions");
|
|
9
|
+
class Trending {
|
|
10
|
+
constructor(parent) {
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns Videos that are trending on TikTok.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* for await (const video of api.trending.videos()) {
|
|
19
|
+
* console.log(video.id);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
async *videos(count = 30, kwargs = {}) {
|
|
24
|
+
let found = 0;
|
|
25
|
+
while (found < count) {
|
|
26
|
+
const batchSize = Math.min(count - found, 30);
|
|
27
|
+
const params = {
|
|
28
|
+
from_page: "fyp",
|
|
29
|
+
count: batchSize,
|
|
30
|
+
};
|
|
31
|
+
const resp = await this.parent.makeRequest({
|
|
32
|
+
url: "https://www.tiktok.com/api/recommend/item_list/",
|
|
33
|
+
params,
|
|
34
|
+
headers: kwargs.headers,
|
|
35
|
+
sessionIndex: kwargs.sessionIndex,
|
|
36
|
+
});
|
|
37
|
+
if (resp == null) {
|
|
38
|
+
throw new exceptions_1.InvalidResponseException(resp, "TikTok returned an invalid response.");
|
|
39
|
+
}
|
|
40
|
+
const itemList = resp["itemList"] ?? [];
|
|
41
|
+
if (itemList.length === 0)
|
|
42
|
+
return; // If no items returned, stop to avoid infinite loop
|
|
43
|
+
for (const item of itemList) {
|
|
44
|
+
yield this.parent.video({ data: item });
|
|
45
|
+
found++;
|
|
46
|
+
}
|
|
47
|
+
if (!resp["hasMore"])
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.Trending = Trending;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { TikTokApi } from "../tiktok";
|
|
2
|
+
import type { Video } from "./video";
|
|
3
|
+
import type { Playlist } from "./playlist";
|
|
4
|
+
export interface UserOptions {
|
|
5
|
+
username?: string | null;
|
|
6
|
+
userId?: string | null;
|
|
7
|
+
secUid?: string | null;
|
|
8
|
+
data?: Record<string, unknown> | null;
|
|
9
|
+
}
|
|
10
|
+
export declare class User {
|
|
11
|
+
/** Static reference to the parent TikTokApi instance */
|
|
12
|
+
parent: TikTokApi;
|
|
13
|
+
/** The ID of the user */
|
|
14
|
+
userId?: string;
|
|
15
|
+
/** The secondary UID of the user */
|
|
16
|
+
secUid?: string;
|
|
17
|
+
/** The username of the user */
|
|
18
|
+
username?: string;
|
|
19
|
+
/** The raw data associated with this user */
|
|
20
|
+
asDict?: Record<string, unknown>;
|
|
21
|
+
constructor(parent: TikTokApi, { username, userId, secUid, data }?: UserOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Returns whether the user is currently live on TikTok.
|
|
24
|
+
* Based on the presence of a non-zero roomId in the user info data.
|
|
25
|
+
*/
|
|
26
|
+
get isLive(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the roomId of the user if they are currently live on TikTok.
|
|
29
|
+
* Returns null if they are not live.
|
|
30
|
+
*/
|
|
31
|
+
get roomId(): string | null;
|
|
32
|
+
/** Gets the user's display name */
|
|
33
|
+
get nickname(): string | null;
|
|
34
|
+
/** Gets the user's bio / signature */
|
|
35
|
+
get signature(): string | null;
|
|
36
|
+
/** Gets whether the user is a verified account */
|
|
37
|
+
get verified(): boolean;
|
|
38
|
+
/** Gets whether the user has a private account */
|
|
39
|
+
get isPrivate(): boolean;
|
|
40
|
+
/** Gets the user's follower count */
|
|
41
|
+
get followers(): number;
|
|
42
|
+
/** Gets the user's following count */
|
|
43
|
+
get following(): number;
|
|
44
|
+
/** Gets the user's total likes (hearts) */
|
|
45
|
+
get likes(): number;
|
|
46
|
+
/** Gets the user's total video count */
|
|
47
|
+
get videoCount(): number;
|
|
48
|
+
/** Gets the user's link in bio */
|
|
49
|
+
get bioLink(): string | null;
|
|
50
|
+
/** Gets the user's profile picture URL (largest available) */
|
|
51
|
+
get avatar(): string | null;
|
|
52
|
+
private _extractUserInfoValue;
|
|
53
|
+
private _extractUserStatsValue;
|
|
54
|
+
/**
|
|
55
|
+
* Returns a dictionary of information associated with this User.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const userData = await api.user({ username: 'therock' }).info();
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
info(kwargs?: {
|
|
63
|
+
msToken?: string;
|
|
64
|
+
headers?: Record<string, string>;
|
|
65
|
+
sessionIndex?: number;
|
|
66
|
+
}): Promise<Record<string, unknown>>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns a user's playlists.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* for await (const playlist of api.user({ username: 'therock' }).playlists()) {
|
|
73
|
+
* console.log(playlist.name);
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
playlists(count?: number, cursor?: number, kwargs?: {
|
|
78
|
+
headers?: Record<string, string>;
|
|
79
|
+
sessionIndex?: number;
|
|
80
|
+
}): AsyncGenerator<Playlist>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns a user's videos.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* for await (const video of api.user({ username: 'davidteathercodes' }).videos()) {
|
|
87
|
+
* console.log(video.id);
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
videos(count?: number, cursor?: number, kwargs?: {
|
|
92
|
+
headers?: Record<string, string>;
|
|
93
|
+
sessionIndex?: number;
|
|
94
|
+
}): AsyncGenerator<Video>;
|
|
95
|
+
/**
|
|
96
|
+
* Returns a user's pinned videos.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* for await (const video of api.user({ username: 'davidteathercodes' }).pinned()) {
|
|
101
|
+
* console.log(video.id);
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
pinned(count?: number, kwargs?: {
|
|
106
|
+
headers?: Record<string, string>;
|
|
107
|
+
sessionIndex?: number;
|
|
108
|
+
}): AsyncGenerator<Video>;
|
|
109
|
+
/**
|
|
110
|
+
* Returns a user's liked posts (if public).
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* for await (const like of api.user({ username: 'davidteathercodes' }).liked()) {
|
|
115
|
+
* console.log(like.id);
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
liked(count?: number, cursor?: number, kwargs?: {
|
|
120
|
+
headers?: Record<string, string>;
|
|
121
|
+
sessionIndex?: number;
|
|
122
|
+
}): AsyncGenerator<Video>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns a user's reposted videos (if available).
|
|
125
|
+
* Note: TikTok might restrict visibility based on authentication or region.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* for await (const repost of api.user({ username: 'davidteathercodes' }).reposts()) {
|
|
130
|
+
* console.log(repost.id);
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
reposts(count?: number, cursor?: number, kwargs?: {
|
|
135
|
+
headers?: Record<string, string>;
|
|
136
|
+
sessionIndex?: number;
|
|
137
|
+
}): AsyncGenerator<Video>;
|
|
138
|
+
/**
|
|
139
|
+
* Returns a user's favorited/bookmarked videos (Collections).
|
|
140
|
+
* Note: This relies entirely on the user's privacy settings.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* for await (const fav of api.user({ username: 'davidteathercodes' }).favorited()) {
|
|
145
|
+
* console.log(fav.id);
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
favorited(count?: number, cursor?: number, kwargs?: {
|
|
150
|
+
headers?: Record<string, string>;
|
|
151
|
+
sessionIndex?: number;
|
|
152
|
+
}): AsyncGenerator<Video>;
|
|
153
|
+
/**
|
|
154
|
+
* Returns a user's followers list.
|
|
155
|
+
* Note: This endpoint is heavily guarded and usually requires a logged-in session (cookies).
|
|
156
|
+
* It may also quickly return errors or bot challenges.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* for await (const follower of api.user({ username: 'davidteathercodes' }).followersList()) {
|
|
161
|
+
* console.log(follower.username);
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
followersList(count?: number, cursor?: number, kwargs?: {
|
|
166
|
+
headers?: Record<string, string>;
|
|
167
|
+
sessionIndex?: number;
|
|
168
|
+
}): AsyncGenerator<User>;
|
|
169
|
+
/**
|
|
170
|
+
* Returns a user's following list.
|
|
171
|
+
* Note: Like followers, this is heavily guarded and requires authentication.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* for await (const following of api.user({ username: 'davidteathercodes' }).followingList()) {
|
|
176
|
+
* console.log(following.username);
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
followingList(count?: number, cursor?: number, kwargs?: {
|
|
181
|
+
headers?: Record<string, string>;
|
|
182
|
+
sessionIndex?: number;
|
|
183
|
+
}): AsyncGenerator<User>;
|
|
184
|
+
private _extractFromData;
|
|
185
|
+
private _updateIdSecUidUsername;
|
|
186
|
+
toString(): string;
|
|
187
|
+
}
|