@nxgiang/tiktok-api 1.3.7
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/CHANGELOG.md +492 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +95 -0
- package/LICENSE +201 -0
- package/README.md +1663 -0
- package/bun.lock +367 -0
- package/helper/signature.js +390 -0
- package/helper/webmssdk.js +4586 -0
- package/helper/xbogus.js +563 -0
- package/install.sh +51 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +809 -0
- package/lib/constants/api.d.ts +22 -0
- package/lib/constants/api.js +39 -0
- package/lib/constants/headers.d.ts +2 -0
- package/lib/constants/headers.js +5 -0
- package/lib/constants/index.d.ts +23 -0
- package/lib/constants/index.js +26 -0
- package/lib/constants/params.d.ts +19 -0
- package/lib/constants/params.js +531 -0
- package/lib/index.d.ts +93 -0
- package/lib/index.js +137 -0
- package/lib/lib/logger.d.ts +8 -0
- package/lib/lib/logger.js +25 -0
- package/lib/services/cookieManager.d.ts +10 -0
- package/lib/services/cookieManager.js +51 -0
- package/lib/services/downloadManager.d.ts +5 -0
- package/lib/services/downloadManager.js +188 -0
- package/lib/services/tiktokService.d.ts +14 -0
- package/lib/services/tiktokService.js +78 -0
- package/lib/types/common.d.ts +65 -0
- package/lib/types/common.js +2 -0
- package/lib/types/cookieManager.d.ts +13 -0
- package/lib/types/cookieManager.js +2 -0
- package/lib/types/downloader/musicaldownDownloader.d.ts +27 -0
- package/lib/types/downloader/musicaldownDownloader.js +2 -0
- package/lib/types/downloader/ssstikDownloader.d.ts +30 -0
- package/lib/types/downloader/ssstikDownloader.js +2 -0
- package/lib/types/downloader/tiktokApiDownloader.d.ts +38 -0
- package/lib/types/downloader/tiktokApiDownloader.js +2 -0
- package/lib/types/get/getCollection.d.ts +53 -0
- package/lib/types/get/getCollection.js +2 -0
- package/lib/types/get/getComments.d.ts +26 -0
- package/lib/types/get/getComments.js +2 -0
- package/lib/types/get/getMusicDetail.d.ts +49 -0
- package/lib/types/get/getMusicDetail.js +2 -0
- package/lib/types/get/getMusicVideos.d.ts +93 -0
- package/lib/types/get/getMusicVideos.js +2 -0
- package/lib/types/get/getPlaylist.d.ts +65 -0
- package/lib/types/get/getPlaylist.js +2 -0
- package/lib/types/get/getProfile.d.ts +71 -0
- package/lib/types/get/getProfile.js +2 -0
- package/lib/types/get/getTrendings.d.ts +61 -0
- package/lib/types/get/getTrendings.js +2 -0
- package/lib/types/get/getUserLiked.d.ts +90 -0
- package/lib/types/get/getUserLiked.js +2 -0
- package/lib/types/get/getUserPosts.d.ts +68 -0
- package/lib/types/get/getUserPosts.js +2 -0
- package/lib/types/get/getUserReposts.d.ts +104 -0
- package/lib/types/get/getUserReposts.js +2 -0
- package/lib/types/search/index.d.ts +15 -0
- package/lib/types/search/index.js +2 -0
- package/lib/types/search/liveSearch.d.ts +48 -0
- package/lib/types/search/liveSearch.js +2 -0
- package/lib/types/search/userSearch.d.ts +32 -0
- package/lib/types/search/userSearch.js +2 -0
- package/lib/types/search/videoSearch.d.ts +62 -0
- package/lib/types/search/videoSearch.js +2 -0
- package/lib/utils/downloader/musicaldownDownloader.d.ts +2 -0
- package/lib/utils/downloader/musicaldownDownloader.js +193 -0
- package/lib/utils/downloader/ssstikDownloader.d.ts +2 -0
- package/lib/utils/downloader/ssstikDownloader.js +177 -0
- package/lib/utils/downloader/tiktokAPIDownloader.d.ts +3 -0
- package/lib/utils/downloader/tiktokAPIDownloader.js +221 -0
- package/lib/utils/get/getCollection.d.ts +7 -0
- package/lib/utils/get/getCollection.js +113 -0
- package/lib/utils/get/getComments.d.ts +2 -0
- package/lib/utils/get/getComments.js +139 -0
- package/lib/utils/get/getMusicDetail.d.ts +2 -0
- package/lib/utils/get/getMusicDetail.js +68 -0
- package/lib/utils/get/getMusicVideos.d.ts +2 -0
- package/lib/utils/get/getMusicVideos.js +249 -0
- package/lib/utils/get/getPlaylist.d.ts +7 -0
- package/lib/utils/get/getPlaylist.js +115 -0
- package/lib/utils/get/getProfile.d.ts +2 -0
- package/lib/utils/get/getProfile.js +92 -0
- package/lib/utils/get/getTrendings.d.ts +7 -0
- package/lib/utils/get/getTrendings.js +120 -0
- package/lib/utils/get/getUserLiked.d.ts +2 -0
- package/lib/utils/get/getUserLiked.js +204 -0
- package/lib/utils/get/getUserPosts.d.ts +2 -0
- package/lib/utils/get/getUserPosts.js +199 -0
- package/lib/utils/get/getUserRepost.d.ts +2 -0
- package/lib/utils/get/getUserRepost.js +239 -0
- package/lib/utils/search/liveSearch.d.ts +2 -0
- package/lib/utils/search/liveSearch.js +99 -0
- package/lib/utils/search/userSearch.d.ts +2 -0
- package/lib/utils/search/userSearch.js +76 -0
- package/lib/utils/search/videoSearch.d.ts +2 -0
- package/lib/utils/search/videoSearch.js +140 -0
- package/lib/utils/urlExtractors.d.ts +3 -0
- package/lib/utils/urlExtractors.js +37 -0
- package/lib/utils/validator.d.ts +1 -0
- package/lib/utils/validator.js +13 -0
- package/package.json +60 -0
- package/test/collection-test.ts +73 -0
- package/test/comments-test.ts +54 -0
- package/test/downloader-v1-test.ts +49 -0
- package/test/downloader-v2-test.ts +47 -0
- package/test/downloader-v3-test.ts +35 -0
- package/test/music-detail-test.ts +97 -0
- package/test/music-videos-test.ts +86 -0
- package/test/playlist-test.ts +48 -0
- package/test/profile-test.ts +49 -0
- package/test/search-live-test.ts +42 -0
- package/test/search-user-test.ts +46 -0
- package/test/search-video-test.ts +53 -0
- package/test/trending-test.ts +128 -0
- package/test/userliked-test.ts +65 -0
- package/test/userposts-test.ts +56 -0
- package/test/userreposts-test.ts +57 -0
- package/tobyg74-tiktok-api-1.3.7.tgz +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const _tiktokDesktopUrl: string;
|
|
2
|
+
export declare const _tiktokMobileUrl: string;
|
|
3
|
+
export declare const _tiktokSearchUserFull: (params: any) => string;
|
|
4
|
+
export declare const _tiktokSearchVideoFull: (params: any) => string;
|
|
5
|
+
export declare const _tiktokSearchLiveFull: (params: any) => string;
|
|
6
|
+
export declare const _tiktokGetPosts: (params: any) => string;
|
|
7
|
+
export declare const _tiktokGetReposts: (params: any) => string;
|
|
8
|
+
export declare const _tiktokGetComments: (params: any) => string;
|
|
9
|
+
export declare const _tiktokGetUserLiked: (params: any) => string;
|
|
10
|
+
export declare const _tiktokGetCollection: (params: any) => string;
|
|
11
|
+
export declare const _tiktokGetPlaylist: (params: any) => string;
|
|
12
|
+
export declare const _tiktokGetHashtag: (params: any) => string;
|
|
13
|
+
export declare const _tiktokGetMusic: (params: any) => string;
|
|
14
|
+
export declare const _tiktokGetMusicDetail: () => string;
|
|
15
|
+
export declare const _tiktokTrendings: (params: any) => string;
|
|
16
|
+
export declare const _tiktokvApi: string;
|
|
17
|
+
export declare const _tiktokvFeed: (params: any) => string;
|
|
18
|
+
export declare const _ssstikurl: string;
|
|
19
|
+
export declare const _ssstikapi: string;
|
|
20
|
+
export declare const _musicaldownurl: string;
|
|
21
|
+
export declare const _musicaldownapi: string;
|
|
22
|
+
export declare const _musicaldownmusicapi: string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._musicaldownmusicapi = exports._musicaldownapi = exports._musicaldownurl = exports._ssstikapi = exports._ssstikurl = exports._tiktokvFeed = exports._tiktokvApi = exports._tiktokTrendings = exports._tiktokGetMusicDetail = exports._tiktokGetMusic = exports._tiktokGetHashtag = exports._tiktokGetPlaylist = exports._tiktokGetCollection = exports._tiktokGetUserLiked = exports._tiktokGetComments = exports._tiktokGetReposts = exports._tiktokGetPosts = exports._tiktokSearchLiveFull = exports._tiktokSearchVideoFull = exports._tiktokSearchUserFull = exports._tiktokMobileUrl = exports._tiktokDesktopUrl = void 0;
|
|
4
|
+
exports._tiktokDesktopUrl = "https://www.tiktok.com";
|
|
5
|
+
exports._tiktokMobileUrl = "https://m.tiktok.com";
|
|
6
|
+
const _tiktokSearchUserFull = (params) => `${exports._tiktokDesktopUrl}/api/search/user/full/?${params}`;
|
|
7
|
+
exports._tiktokSearchUserFull = _tiktokSearchUserFull;
|
|
8
|
+
const _tiktokSearchVideoFull = (params) => `${exports._tiktokDesktopUrl}/api/search/item/full/?${params}`;
|
|
9
|
+
exports._tiktokSearchVideoFull = _tiktokSearchVideoFull;
|
|
10
|
+
const _tiktokSearchLiveFull = (params) => `${exports._tiktokDesktopUrl}/api/search/live/full/?${params}`;
|
|
11
|
+
exports._tiktokSearchLiveFull = _tiktokSearchLiveFull;
|
|
12
|
+
const _tiktokGetPosts = (params) => `${exports._tiktokDesktopUrl}/api/post/item_list/?${params}`;
|
|
13
|
+
exports._tiktokGetPosts = _tiktokGetPosts;
|
|
14
|
+
const _tiktokGetReposts = (params) => `${exports._tiktokDesktopUrl}/api/repost/item_list/?${params}`;
|
|
15
|
+
exports._tiktokGetReposts = _tiktokGetReposts;
|
|
16
|
+
const _tiktokGetComments = (params) => `${exports._tiktokDesktopUrl}/api/comment/list/?${params}`;
|
|
17
|
+
exports._tiktokGetComments = _tiktokGetComments;
|
|
18
|
+
const _tiktokGetUserLiked = (params) => `${exports._tiktokDesktopUrl}/api/favorite/item_list/?${params}`;
|
|
19
|
+
exports._tiktokGetUserLiked = _tiktokGetUserLiked;
|
|
20
|
+
const _tiktokGetCollection = (params) => `${exports._tiktokDesktopUrl}/api/collection/item_list/?${params}`;
|
|
21
|
+
exports._tiktokGetCollection = _tiktokGetCollection;
|
|
22
|
+
const _tiktokGetPlaylist = (params) => `${exports._tiktokDesktopUrl}/api/mix/item_list/?${params}`;
|
|
23
|
+
exports._tiktokGetPlaylist = _tiktokGetPlaylist;
|
|
24
|
+
const _tiktokGetHashtag = (params) => `${exports._tiktokDesktopUrl}/api/challenge/item_list/?${params}`;
|
|
25
|
+
exports._tiktokGetHashtag = _tiktokGetHashtag;
|
|
26
|
+
const _tiktokGetMusic = (params) => `${exports._tiktokDesktopUrl}/api/music/item_list/?${params}`;
|
|
27
|
+
exports._tiktokGetMusic = _tiktokGetMusic;
|
|
28
|
+
const _tiktokGetMusicDetail = () => `${exports._tiktokMobileUrl}/api/music/detail/`;
|
|
29
|
+
exports._tiktokGetMusicDetail = _tiktokGetMusicDetail;
|
|
30
|
+
const _tiktokTrendings = (params) => `${exports._tiktokDesktopUrl}/node/share/discover?${params}`;
|
|
31
|
+
exports._tiktokTrendings = _tiktokTrendings;
|
|
32
|
+
exports._tiktokvApi = `https://api16-normal-useast5.tiktokv.us`;
|
|
33
|
+
const _tiktokvFeed = (params) => `${exports._tiktokvApi}/aweme/v1/feed/?${params}`;
|
|
34
|
+
exports._tiktokvFeed = _tiktokvFeed;
|
|
35
|
+
exports._ssstikurl = "https://ssstik.io";
|
|
36
|
+
exports._ssstikapi = `${exports._ssstikurl}/abc?url=dl`;
|
|
37
|
+
exports._musicaldownurl = "https://musicaldown.com";
|
|
38
|
+
exports._musicaldownapi = `${exports._musicaldownurl}/download`;
|
|
39
|
+
exports._musicaldownmusicapi = `${exports._musicaldownurl}/mp3/download`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webUserAgent = exports.userAgent = void 0;
|
|
4
|
+
exports.userAgent = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0";
|
|
5
|
+
exports.webUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const DOWNLOADER_VERSIONS: {
|
|
2
|
+
readonly V1: "v1";
|
|
3
|
+
readonly V2: "v2";
|
|
4
|
+
readonly V3: "v3";
|
|
5
|
+
};
|
|
6
|
+
export declare const SEARCH_TYPES: {
|
|
7
|
+
readonly USER: "user";
|
|
8
|
+
readonly LIVE: "live";
|
|
9
|
+
readonly VIDEO: "video";
|
|
10
|
+
};
|
|
11
|
+
export declare const ERROR_MESSAGES: {
|
|
12
|
+
readonly COOKIE_REQUIRED: "Cookie is required!";
|
|
13
|
+
readonly INVALID_VERSION: "Invalid downloader version";
|
|
14
|
+
readonly INVALID_SEARCH_TYPE: "Invalid search type";
|
|
15
|
+
readonly INVALID_URL: "Invalid TikTok URL";
|
|
16
|
+
readonly NETWORK_ERROR: "Network error occurred";
|
|
17
|
+
readonly RATE_LIMIT: "Rate limit exceeded";
|
|
18
|
+
};
|
|
19
|
+
export declare const DEFAULT_LIMITS: {
|
|
20
|
+
readonly POST_LIMIT: 30;
|
|
21
|
+
readonly COMMENT_LIMIT: 20;
|
|
22
|
+
readonly SEARCH_PAGE_SIZE: 20;
|
|
23
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_LIMITS = exports.ERROR_MESSAGES = exports.SEARCH_TYPES = exports.DOWNLOADER_VERSIONS = void 0;
|
|
4
|
+
exports.DOWNLOADER_VERSIONS = {
|
|
5
|
+
V1: "v1",
|
|
6
|
+
V2: "v2",
|
|
7
|
+
V3: "v3"
|
|
8
|
+
};
|
|
9
|
+
exports.SEARCH_TYPES = {
|
|
10
|
+
USER: "user",
|
|
11
|
+
LIVE: "live",
|
|
12
|
+
VIDEO: "video"
|
|
13
|
+
};
|
|
14
|
+
exports.ERROR_MESSAGES = {
|
|
15
|
+
COOKIE_REQUIRED: "Cookie is required!",
|
|
16
|
+
INVALID_VERSION: "Invalid downloader version",
|
|
17
|
+
INVALID_SEARCH_TYPE: "Invalid search type",
|
|
18
|
+
INVALID_URL: "Invalid TikTok URL",
|
|
19
|
+
NETWORK_ERROR: "Network error occurred",
|
|
20
|
+
RATE_LIMIT: "Rate limit exceeded"
|
|
21
|
+
};
|
|
22
|
+
exports.DEFAULT_LIMITS = {
|
|
23
|
+
POST_LIMIT: 30,
|
|
24
|
+
COMMENT_LIMIT: 20,
|
|
25
|
+
SEARCH_PAGE_SIZE: 20
|
|
26
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const _getTrendingsParams: () => string;
|
|
2
|
+
export declare const _getUserPostsParams: () => string;
|
|
3
|
+
export declare const _getUserRepostsParams: (secUid: string, cursor: number, count: number) => string;
|
|
4
|
+
export declare const _getUserLikedParams: (id: string, secUid: string, count: number) => string;
|
|
5
|
+
export declare const _xttParams: (secUid: string, cursor: number, count: number) => string;
|
|
6
|
+
export declare const _getCommentsParams: (id: string, cursor?: number) => string;
|
|
7
|
+
export declare const _userSearchParams: (keyword: string, page: number, xbogus?: string) => string;
|
|
8
|
+
export declare const _liveSearchParams: (keyword: string, page: number) => URLSearchParams;
|
|
9
|
+
export declare const _videoSearchParams: (keyword: string, page: number) => string;
|
|
10
|
+
export declare const _tiktokApiParams: (args: any) => string;
|
|
11
|
+
declare const randomChar: (char: string, range: number) => string;
|
|
12
|
+
declare const generateSearchId: () => string;
|
|
13
|
+
declare const generateDeviceId: () => string;
|
|
14
|
+
declare const generateOdinId: () => string;
|
|
15
|
+
export declare const _getCollectionParams: (collectionId: string, page?: number, count?: number) => string;
|
|
16
|
+
export declare const _getPlaylistParams: (playlistId: string, page?: number, count?: number) => string;
|
|
17
|
+
export declare const _getMusicVideosParams: (musicId: string, cursor?: number, count?: number) => string;
|
|
18
|
+
export declare const _getMusicDetailParams: (musicId: string) => string;
|
|
19
|
+
export { randomChar, generateSearchId, generateDeviceId, generateOdinId };
|
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateOdinId = exports.generateDeviceId = exports.generateSearchId = exports.randomChar = exports._getMusicDetailParams = exports._getMusicVideosParams = exports._getPlaylistParams = exports._getCollectionParams = exports._tiktokApiParams = exports._videoSearchParams = exports._liveSearchParams = exports._userSearchParams = exports._getCommentsParams = exports._xttParams = exports._getUserLikedParams = exports._getUserRepostsParams = exports._getUserPostsParams = exports._getTrendingsParams = void 0;
|
|
7
|
+
const qs_1 = __importDefault(require("qs"));
|
|
8
|
+
const _getTrendingsParams = () => {
|
|
9
|
+
return qs_1.default.stringify({
|
|
10
|
+
aid: 1988,
|
|
11
|
+
app_language: "en",
|
|
12
|
+
app_name: "tiktok_web",
|
|
13
|
+
battery_info: 1
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
exports._getTrendingsParams = _getTrendingsParams;
|
|
17
|
+
const _getUserPostsParams = () => {
|
|
18
|
+
return (qs_1.default.stringify({
|
|
19
|
+
aid: 1988,
|
|
20
|
+
app_language: "en",
|
|
21
|
+
app_name: "tiktok_web",
|
|
22
|
+
battery_info: 1,
|
|
23
|
+
browser_language: "en-US",
|
|
24
|
+
browser_name: "Mozilla",
|
|
25
|
+
browser_online: true,
|
|
26
|
+
browser_platform: "Win32",
|
|
27
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35",
|
|
28
|
+
channel: "tiktok_web",
|
|
29
|
+
cookie_enabled: true,
|
|
30
|
+
device_id: "7002566096994190854",
|
|
31
|
+
device_platform: "web_pc",
|
|
32
|
+
focus_state: false,
|
|
33
|
+
from_page: "user",
|
|
34
|
+
history_len: 3,
|
|
35
|
+
is_fullscreen: false,
|
|
36
|
+
is_page_visible: true,
|
|
37
|
+
os: "windows",
|
|
38
|
+
priority_region: "RO",
|
|
39
|
+
referer: "https://exportcomments.com/",
|
|
40
|
+
region: "RO",
|
|
41
|
+
root_referer: "https://exportcomments.com/",
|
|
42
|
+
screen_height: 1440,
|
|
43
|
+
screen_width: 2560,
|
|
44
|
+
tz_name: "Europe/Bucharest",
|
|
45
|
+
verifyFp: "verify_lacphy8d_z2ux9idt_xdmu_4gKb_9nng_NNTTTvsFS8ao",
|
|
46
|
+
webcast_language: "en"
|
|
47
|
+
}) +
|
|
48
|
+
"&msToken=7UfjxOYL5mVC8QFOKQRhmLR3pCjoxewuwxtfFIcPweqC05Q6C_qjW-5Ba6_fE5-fkZc0wkLSWaaesA4CZ0LAqRrXSL8b88jGvEjbZPwLIPnHeyQq6VifzyKf5oGCQNw_W4Xq12Q-8KCuyiKGLOw=&X-Bogus=DFSzswVL-XGANHVWS0OnS2XyYJUm");
|
|
49
|
+
};
|
|
50
|
+
exports._getUserPostsParams = _getUserPostsParams;
|
|
51
|
+
const _getUserRepostsParams = (secUid, cursor, count) => {
|
|
52
|
+
return qs_1.default.stringify({
|
|
53
|
+
WebIdLastTime: 1743386313,
|
|
54
|
+
aid: 1988,
|
|
55
|
+
app_language: "en",
|
|
56
|
+
app_name: "tiktok_web",
|
|
57
|
+
browser_language: "en-US",
|
|
58
|
+
browser_name: "Mozilla",
|
|
59
|
+
browser_online: true,
|
|
60
|
+
browser_platform: "Win32",
|
|
61
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0",
|
|
62
|
+
channel: "tiktok_web",
|
|
63
|
+
clientABVersions: "",
|
|
64
|
+
...(count ? { count } : { count: 16 }),
|
|
65
|
+
coverFormat: 2,
|
|
66
|
+
...(cursor ? { cursor } : { cursor: 0 }),
|
|
67
|
+
data_collection_enabled: true,
|
|
68
|
+
device_id: "7002566096994190854",
|
|
69
|
+
device_platform: "web_pc",
|
|
70
|
+
focus_state: true,
|
|
71
|
+
from_page: "user",
|
|
72
|
+
history_len: 12,
|
|
73
|
+
is_fullscreen: false,
|
|
74
|
+
is_page_visible: true,
|
|
75
|
+
language: "en",
|
|
76
|
+
os: "windows",
|
|
77
|
+
post_item_list_request_type: 0,
|
|
78
|
+
priority_region: "ID",
|
|
79
|
+
region: "ID",
|
|
80
|
+
screen_height: 1080,
|
|
81
|
+
screen_width: 1920,
|
|
82
|
+
secUid,
|
|
83
|
+
tz_name: "Asia/Jakarta",
|
|
84
|
+
webcast_language: "en"
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
exports._getUserRepostsParams = _getUserRepostsParams;
|
|
88
|
+
const _getUserLikedParams = (id, secUid, count) => {
|
|
89
|
+
let cursor = 0;
|
|
90
|
+
if (count > 50) {
|
|
91
|
+
for (let i = 1; i < count; i++) {
|
|
92
|
+
cursor += 50;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return qs_1.default.stringify({
|
|
96
|
+
aid: "1988",
|
|
97
|
+
cookie_enabled: true,
|
|
98
|
+
screen_width: 0,
|
|
99
|
+
screen_height: 0,
|
|
100
|
+
browser_language: "",
|
|
101
|
+
browser_platform: "",
|
|
102
|
+
browser_name: "",
|
|
103
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0",
|
|
104
|
+
browser_online: "",
|
|
105
|
+
timezone_name: "Europe/London",
|
|
106
|
+
is_page_visible: true,
|
|
107
|
+
id,
|
|
108
|
+
secUid,
|
|
109
|
+
count,
|
|
110
|
+
cursor,
|
|
111
|
+
needPinnedItemIds: true,
|
|
112
|
+
odinId: generateOdinId(),
|
|
113
|
+
history_len: 3,
|
|
114
|
+
user_is_login: true
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
exports._getUserLikedParams = _getUserLikedParams;
|
|
118
|
+
const _xttParams = (secUid, cursor, count) => {
|
|
119
|
+
return qs_1.default.stringify({
|
|
120
|
+
aid: "1988",
|
|
121
|
+
cookie_enabled: true,
|
|
122
|
+
screen_width: 0,
|
|
123
|
+
screen_height: 0,
|
|
124
|
+
browser_language: "",
|
|
125
|
+
browser_platform: "",
|
|
126
|
+
browser_name: "",
|
|
127
|
+
browser_version: "",
|
|
128
|
+
browser_online: "",
|
|
129
|
+
timezone_name: "Europe/London",
|
|
130
|
+
secUid,
|
|
131
|
+
cursor,
|
|
132
|
+
count,
|
|
133
|
+
is_encryption: 1
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
exports._xttParams = _xttParams;
|
|
137
|
+
const _getCommentsParams = (id, cursor = 0) => {
|
|
138
|
+
return qs_1.default.stringify({
|
|
139
|
+
aid: "1988",
|
|
140
|
+
app_language: "ja-JP",
|
|
141
|
+
app_name: "tiktok_web",
|
|
142
|
+
aweme_id: id,
|
|
143
|
+
browser_language: "en-US",
|
|
144
|
+
browser_name: "Mozilla",
|
|
145
|
+
browser_online: true,
|
|
146
|
+
browser_platform: "Linux x86_64",
|
|
147
|
+
browser_version: "5.0 (X11)",
|
|
148
|
+
channel: "tiktok_web",
|
|
149
|
+
cookie_enabled: true,
|
|
150
|
+
count: 50,
|
|
151
|
+
cursor: cursor,
|
|
152
|
+
device_id: generateDeviceId(),
|
|
153
|
+
os: "linux",
|
|
154
|
+
region: "ID",
|
|
155
|
+
screen_height: 768,
|
|
156
|
+
screen_width: 1366
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
exports._getCommentsParams = _getCommentsParams;
|
|
160
|
+
const _userSearchParams = (keyword, page, xbogus) => {
|
|
161
|
+
let cursor = 0;
|
|
162
|
+
if (page > 1) {
|
|
163
|
+
for (let i = 1; i < page; i++) {
|
|
164
|
+
cursor += 10;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const params = {
|
|
168
|
+
WebIdLastTime: Date.now(),
|
|
169
|
+
aid: "1988",
|
|
170
|
+
app_language: "en",
|
|
171
|
+
app_name: "tiktok_web",
|
|
172
|
+
browser_language: "en-US",
|
|
173
|
+
browser_name: "Mozilla",
|
|
174
|
+
browser_online: true,
|
|
175
|
+
browser_platform: "Win32",
|
|
176
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0",
|
|
177
|
+
channel: "tiktok_web",
|
|
178
|
+
cookie_enabled: true,
|
|
179
|
+
cursor: cursor,
|
|
180
|
+
data_collection_enabled: true,
|
|
181
|
+
device_id: "7487787165935371783",
|
|
182
|
+
device_platform: "web_pc",
|
|
183
|
+
focus_state: true,
|
|
184
|
+
from_page: "search",
|
|
185
|
+
history_len: 4,
|
|
186
|
+
is_fullscreen: false,
|
|
187
|
+
is_page_visible: true,
|
|
188
|
+
keyword: keyword,
|
|
189
|
+
odinId: generateOdinId(),
|
|
190
|
+
os: "windows",
|
|
191
|
+
priority_region: "ID",
|
|
192
|
+
referer: "",
|
|
193
|
+
region: "ID",
|
|
194
|
+
screen_height: 1080,
|
|
195
|
+
screen_width: 1920,
|
|
196
|
+
tz_name: "Asia/Jakarta",
|
|
197
|
+
user_is_login: true,
|
|
198
|
+
web_search_code: {
|
|
199
|
+
tiktok: {
|
|
200
|
+
client_params_x: {
|
|
201
|
+
search_engine: {
|
|
202
|
+
ies_mt_user_live_video_card_use_libra: 1,
|
|
203
|
+
mt_search_general_user_live_card: 1
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
search_server: {}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
webcast_language: "en"
|
|
210
|
+
};
|
|
211
|
+
if (xbogus) {
|
|
212
|
+
params["X-Bogus"] = xbogus;
|
|
213
|
+
}
|
|
214
|
+
return qs_1.default.stringify(params);
|
|
215
|
+
};
|
|
216
|
+
exports._userSearchParams = _userSearchParams;
|
|
217
|
+
const _liveSearchParams = (keyword, page) => {
|
|
218
|
+
let cursor = 0;
|
|
219
|
+
if (page > 1) {
|
|
220
|
+
for (let i = 1; i < page; i++) {
|
|
221
|
+
cursor += 12;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
let offset = `${cursor}`;
|
|
225
|
+
return new URLSearchParams({
|
|
226
|
+
WebIdLastTime: "1720342268",
|
|
227
|
+
aid: "1988",
|
|
228
|
+
app_language: "en",
|
|
229
|
+
app_name: "tiktok_web",
|
|
230
|
+
browser_language: "en-US",
|
|
231
|
+
browser_name: "Mozilla",
|
|
232
|
+
browser_online: "true",
|
|
233
|
+
browser_platform: "Linux x86_64",
|
|
234
|
+
browser_version: "5.0 (X11)",
|
|
235
|
+
channel: "tiktok_web",
|
|
236
|
+
cookie_enabled: "true",
|
|
237
|
+
count: "20",
|
|
238
|
+
device_id: "7487787165935371783",
|
|
239
|
+
device_platform: "web_pc",
|
|
240
|
+
device_type: "web_h264",
|
|
241
|
+
focus_state: "true",
|
|
242
|
+
from_page: "search",
|
|
243
|
+
history_len: "10",
|
|
244
|
+
is_fullscreen: "false",
|
|
245
|
+
is_page_visible: "true",
|
|
246
|
+
keyword,
|
|
247
|
+
offset,
|
|
248
|
+
os: "linux",
|
|
249
|
+
priority_region: "",
|
|
250
|
+
referer: "",
|
|
251
|
+
region: "ID",
|
|
252
|
+
screen_height: "768",
|
|
253
|
+
screen_width: "1366",
|
|
254
|
+
tz_name: "Asia/Jakarta",
|
|
255
|
+
search_id: generateSearchId(),
|
|
256
|
+
web_search_code: "{ tiktok: { client_params_x: { search_engine: { ies_mt_user_live_video_card_use_libra: 1, mt_search_general_user_live_card: 1 } }, search_server: {} } }",
|
|
257
|
+
webcast_language: "en"
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
exports._liveSearchParams = _liveSearchParams;
|
|
261
|
+
const _videoSearchParams = (keyword, page) => {
|
|
262
|
+
let cursor = 0;
|
|
263
|
+
if (page > 1) {
|
|
264
|
+
for (let i = 1; i < page; i++) {
|
|
265
|
+
cursor += 12;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
let offset = `${cursor}`;
|
|
269
|
+
return qs_1.default.stringify({
|
|
270
|
+
WebIdLastTime: "1720342268",
|
|
271
|
+
aid: "1988",
|
|
272
|
+
app_language: "en",
|
|
273
|
+
app_name: "tiktok_web",
|
|
274
|
+
browser_language: "en-US",
|
|
275
|
+
browser_name: "Mozilla",
|
|
276
|
+
browser_online: "true",
|
|
277
|
+
browser_platform: "Linux x86_64",
|
|
278
|
+
browser_version: "5.0 (X11)",
|
|
279
|
+
channel: "tiktok_web",
|
|
280
|
+
cookie_enabled: "true",
|
|
281
|
+
count: "20",
|
|
282
|
+
device_id: "7487787165935371783",
|
|
283
|
+
device_platform: "web_pc",
|
|
284
|
+
device_type: "web_h264",
|
|
285
|
+
focus_state: "true",
|
|
286
|
+
from_page: "search",
|
|
287
|
+
history_len: "10",
|
|
288
|
+
is_fullscreen: "false",
|
|
289
|
+
is_page_visible: "true",
|
|
290
|
+
is_user_login: "true",
|
|
291
|
+
keyword,
|
|
292
|
+
offset,
|
|
293
|
+
os: "linux",
|
|
294
|
+
priority_region: "",
|
|
295
|
+
referer: "",
|
|
296
|
+
region: "ID",
|
|
297
|
+
screen_height: "768",
|
|
298
|
+
screen_width: "1366",
|
|
299
|
+
tz_name: "Asia/Jakarta",
|
|
300
|
+
search_id: generateSearchId(),
|
|
301
|
+
web_search_code: "{ tiktok: { client_params_x: { search_engine: { ies_mt_user_live_video_card_use_libra: 1, mt_search_general_user_live_card: 1 } }, search_server: {} } }",
|
|
302
|
+
webcast_language: "en"
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
exports._videoSearchParams = _videoSearchParams;
|
|
306
|
+
const _tiktokApiParams = (args) => {
|
|
307
|
+
return new URLSearchParams({
|
|
308
|
+
...args,
|
|
309
|
+
version_name: "1.1.9",
|
|
310
|
+
version_code: "2018111632",
|
|
311
|
+
build_number: "1.1.9",
|
|
312
|
+
device_id: generateDeviceId(),
|
|
313
|
+
iid: generateDeviceId(),
|
|
314
|
+
manifest_version_code: "2018111632",
|
|
315
|
+
update_version_code: "2018111632",
|
|
316
|
+
openudid: randomChar("0123456789abcdef", 16),
|
|
317
|
+
uuid: randomChar("1234567890", 16),
|
|
318
|
+
_rticket: Date.now() * 1000,
|
|
319
|
+
ts: Date.now(),
|
|
320
|
+
device_brand: "Google",
|
|
321
|
+
device_type: "Pixel 4",
|
|
322
|
+
device_platform: "android",
|
|
323
|
+
resolution: "1080*1920",
|
|
324
|
+
dpi: 420,
|
|
325
|
+
os_version: "10",
|
|
326
|
+
os_api: "29",
|
|
327
|
+
carrier_region: "US",
|
|
328
|
+
sys_region: "US",
|
|
329
|
+
region: "US",
|
|
330
|
+
timezone_name: "America/New_York",
|
|
331
|
+
timezone_offset: "-14400",
|
|
332
|
+
channel: "googleplay",
|
|
333
|
+
ac: "wifi",
|
|
334
|
+
mcc_mnc: "310260",
|
|
335
|
+
is_my_cn: 0,
|
|
336
|
+
ssmix: "a",
|
|
337
|
+
as: "a1qwert123",
|
|
338
|
+
cp: "cbfhckdckkde1"
|
|
339
|
+
}).toString();
|
|
340
|
+
};
|
|
341
|
+
exports._tiktokApiParams = _tiktokApiParams;
|
|
342
|
+
const randomChar = (char, range) => {
|
|
343
|
+
let chars = "";
|
|
344
|
+
for (let i = 0; i < range; i++) {
|
|
345
|
+
chars += char[Math.floor(Math.random() * char.length)];
|
|
346
|
+
}
|
|
347
|
+
return chars;
|
|
348
|
+
};
|
|
349
|
+
exports.randomChar = randomChar;
|
|
350
|
+
const generateSearchId = () => {
|
|
351
|
+
const now = new Date();
|
|
352
|
+
const timestamp = now.getFullYear().toString() +
|
|
353
|
+
(now.getMonth() + 1).toString().padStart(2, "0") +
|
|
354
|
+
now.getDate().toString().padStart(2, "0") +
|
|
355
|
+
now.getHours().toString().padStart(2, "0") +
|
|
356
|
+
now.getMinutes().toString().padStart(2, "0") +
|
|
357
|
+
now.getSeconds().toString().padStart(2, "0");
|
|
358
|
+
const hex = randomChar("0123456789ABCDEF", 32);
|
|
359
|
+
return `${timestamp}${hex}`;
|
|
360
|
+
};
|
|
361
|
+
exports.generateSearchId = generateSearchId;
|
|
362
|
+
const generateDeviceId = () => {
|
|
363
|
+
const prefix = "7";
|
|
364
|
+
const random = randomChar("0123456789", 18);
|
|
365
|
+
return `${prefix}${random}`;
|
|
366
|
+
};
|
|
367
|
+
exports.generateDeviceId = generateDeviceId;
|
|
368
|
+
const generateOdinId = () => {
|
|
369
|
+
const prefix = "7";
|
|
370
|
+
const random = randomChar("0123456789", 18);
|
|
371
|
+
return `${prefix}${random}`;
|
|
372
|
+
};
|
|
373
|
+
exports.generateOdinId = generateOdinId;
|
|
374
|
+
const _getCollectionParams = (collectionId, page = 1, count = 5) => {
|
|
375
|
+
let cursor = 0;
|
|
376
|
+
if (page > 0) {
|
|
377
|
+
cursor = (page - 1) * count;
|
|
378
|
+
}
|
|
379
|
+
return qs_1.default.stringify({
|
|
380
|
+
WebIdLastTime: Date.now(),
|
|
381
|
+
aid: 1988,
|
|
382
|
+
app_language: "en",
|
|
383
|
+
app_name: "tiktok_web",
|
|
384
|
+
browser_language: "en-US",
|
|
385
|
+
browser_name: "Mozilla",
|
|
386
|
+
browser_online: true,
|
|
387
|
+
browser_platform: "Win32",
|
|
388
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",
|
|
389
|
+
channel: "tiktok_web",
|
|
390
|
+
collectionId,
|
|
391
|
+
cookie_enabled: true,
|
|
392
|
+
count,
|
|
393
|
+
cursor: cursor.toString(),
|
|
394
|
+
data_collection_enabled: true,
|
|
395
|
+
device_id: "7002566096994190854",
|
|
396
|
+
device_platform: "web_pc",
|
|
397
|
+
focus_state: true,
|
|
398
|
+
from_page: "user",
|
|
399
|
+
history_len: 3,
|
|
400
|
+
is_fullscreen: false,
|
|
401
|
+
is_page_visible: true,
|
|
402
|
+
language: "en",
|
|
403
|
+
odinId: "7458943931621032978",
|
|
404
|
+
os: "windows",
|
|
405
|
+
priority_region: "NZ",
|
|
406
|
+
referer: "",
|
|
407
|
+
region: "NZ",
|
|
408
|
+
screen_height: 1440,
|
|
409
|
+
screen_width: 2560,
|
|
410
|
+
sourceType: 113,
|
|
411
|
+
tz_name: "Pacific/Auckland",
|
|
412
|
+
user_is_login: true,
|
|
413
|
+
verifyFp: "verify_lacphy8d_z2ux9idt_xdmu_4gKb_9nng_NNTTTvsFS8ao",
|
|
414
|
+
webcast_language: "en"
|
|
415
|
+
});
|
|
416
|
+
};
|
|
417
|
+
exports._getCollectionParams = _getCollectionParams;
|
|
418
|
+
const _getPlaylistParams = (playlistId, page = 1, count = 5) => {
|
|
419
|
+
count = Math.min(Math.max(1, count), 20);
|
|
420
|
+
let cursor = 0;
|
|
421
|
+
if (page > 0) {
|
|
422
|
+
cursor = (page - 1) * count;
|
|
423
|
+
}
|
|
424
|
+
return qs_1.default.stringify({
|
|
425
|
+
WebIdLastTime: Date.now(),
|
|
426
|
+
aid: 1988,
|
|
427
|
+
app_language: "en",
|
|
428
|
+
app_name: "tiktok_web",
|
|
429
|
+
browser_language: "en-US",
|
|
430
|
+
browser_name: "Mozilla",
|
|
431
|
+
browser_online: true,
|
|
432
|
+
browser_platform: "Linux x86_64",
|
|
433
|
+
browser_version: "5.0 (X11)",
|
|
434
|
+
channel: "tiktok_web",
|
|
435
|
+
cookie_enabled: true,
|
|
436
|
+
count,
|
|
437
|
+
cursor: cursor.toString(),
|
|
438
|
+
data_collection_enabled: true,
|
|
439
|
+
device_id: generateDeviceId(),
|
|
440
|
+
device_platform: "web_pc",
|
|
441
|
+
focus_state: true,
|
|
442
|
+
from_page: "user",
|
|
443
|
+
history_len: 1,
|
|
444
|
+
is_fullscreen: false,
|
|
445
|
+
is_page_visible: true,
|
|
446
|
+
language: "en",
|
|
447
|
+
mixId: playlistId,
|
|
448
|
+
odinId: generateOdinId(),
|
|
449
|
+
os: "linux",
|
|
450
|
+
priority_region: "NZ",
|
|
451
|
+
referer: "",
|
|
452
|
+
region: "NZ",
|
|
453
|
+
screen_height: 1440,
|
|
454
|
+
screen_width: 2560,
|
|
455
|
+
tz_name: "Pacific/Auckland",
|
|
456
|
+
user_is_login: true,
|
|
457
|
+
verifyFp: "verify_lacphy8d_z2ux9idt_xdmu_4gKb_9nng_NNTTTvsFS8ao",
|
|
458
|
+
webcast_language: "en"
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
exports._getPlaylistParams = _getPlaylistParams;
|
|
462
|
+
const _getMusicVideosParams = (musicId, cursor = 0, count = 30) => {
|
|
463
|
+
return qs_1.default.stringify({
|
|
464
|
+
aid: 1988,
|
|
465
|
+
app_language: "en",
|
|
466
|
+
app_name: "tiktok_web",
|
|
467
|
+
battery_info: 1,
|
|
468
|
+
browser_language: "en-US",
|
|
469
|
+
browser_name: "Mozilla",
|
|
470
|
+
browser_online: true,
|
|
471
|
+
browser_platform: "Win32",
|
|
472
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53",
|
|
473
|
+
channel: "tiktok_web",
|
|
474
|
+
cookie_enabled: true,
|
|
475
|
+
count,
|
|
476
|
+
cursor,
|
|
477
|
+
device_id: generateDeviceId(),
|
|
478
|
+
device_platform: "web_pc",
|
|
479
|
+
focus_state: false,
|
|
480
|
+
from_page: "music",
|
|
481
|
+
history_len: 1,
|
|
482
|
+
is_fullscreen: false,
|
|
483
|
+
is_page_visible: true,
|
|
484
|
+
musicID: musicId,
|
|
485
|
+
os: "windows",
|
|
486
|
+
priority_region: "US",
|
|
487
|
+
referer: "",
|
|
488
|
+
region: "US",
|
|
489
|
+
screen_height: 1080,
|
|
490
|
+
screen_width: 1920,
|
|
491
|
+
tz_name: "America/New_York",
|
|
492
|
+
timezone_name: "America/New_York",
|
|
493
|
+
verifyFp: "verify_dca8729afe5c502257ed30b0b070dbdb",
|
|
494
|
+
webcast_language: "en"
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
exports._getMusicVideosParams = _getMusicVideosParams;
|
|
498
|
+
const _getMusicDetailParams = (musicId) => {
|
|
499
|
+
return qs_1.default.stringify({
|
|
500
|
+
aid: 1988,
|
|
501
|
+
app_language: "en",
|
|
502
|
+
app_name: "tiktok_web",
|
|
503
|
+
browser_language: "en-US",
|
|
504
|
+
browser_name: "Mozilla",
|
|
505
|
+
browser_online: true,
|
|
506
|
+
browser_platform: "Linux x86_64",
|
|
507
|
+
browser_version: "5.0 (X11)",
|
|
508
|
+
channel: "tiktok_web",
|
|
509
|
+
cookie_enabled: true,
|
|
510
|
+
data_collection_enabled: true,
|
|
511
|
+
device_id: "7551034554073482753",
|
|
512
|
+
device_platform: "web_pc",
|
|
513
|
+
focus_state: true,
|
|
514
|
+
from_page: "music",
|
|
515
|
+
history_len: 5,
|
|
516
|
+
is_fullscreen: false,
|
|
517
|
+
is_page_visible: true,
|
|
518
|
+
language: "en",
|
|
519
|
+
musicId,
|
|
520
|
+
os: "linux",
|
|
521
|
+
priority_region: "ID",
|
|
522
|
+
referer: "https://www.tiktok.com/id-ID/",
|
|
523
|
+
region: "ID",
|
|
524
|
+
root_referer: "https://www.google.com/",
|
|
525
|
+
screen_height: 1080,
|
|
526
|
+
screen_width: 1920,
|
|
527
|
+
tz_name: "Asia/Jakarta",
|
|
528
|
+
is_encryption: 1
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
exports._getMusicDetailParams = _getMusicDetailParams;
|